diff options
author | dawes <dawes> | 2001-03-19 21:38:52 +0000 |
---|---|---|
committer | dawes <dawes> | 2001-03-19 21:38:52 +0000 |
commit | c9a3e2ae446907ec2fd7470f0a51cf2105bc0319 (patch) | |
tree | 3f034e523fa1b41f57c7b2b364073a31fd0d8a75 /xc/programs/Xserver/hw/xfree86/drivers | |
parent | 326ae10581288b55caed7c82f687000ae3693eec (diff) |
Initial XFree86 4.0.99.1 merge.
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers')
122 files changed, 5111 insertions, 9536 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp deleted file mode 100644 index a38fed3b9..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp,v 1.5 2000/12/11 20:18:05 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH APM __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -apm \- Alliance ProMotion video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qapm\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B apm -is an XFree86 driver for Alliance ProMotion video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B apm -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c index ed7dbc03c..15e4eedbe 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.9 2000/12/02 15:30:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.11 2001/01/29 15:15:44 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -28,7 +28,7 @@ * */ - +#define COMPILER_H_EXTRAS #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -43,7 +43,7 @@ #include "mipointer.h" #include "micmap.h" #include "mibstore.h" - +#include "fb.h" #include "ark.h" @@ -73,7 +73,7 @@ static void ARKLoadPalette(ScrnInfoPtr pScrn, int numColors, static void ARKWriteMode(ScrnInfoPtr pScrn, vgaRegPtr pVga, ARKRegPtr new); /* helpers */ -static unsigned char get_daccomm(); +static unsigned char get_daccomm(void); static unsigned char set_daccom(unsigned char comm); @@ -262,11 +262,8 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags) EntityInfoPtr pEnt; ARKPtr pARK; vgaHWPtr hwp; - MessageType from = X_DEFAULT; int i; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; rgb zeros = {0, 0, 0}; Gamma gzeros = {0.0, 0.0, 0.0}; unsigned char tmp; @@ -414,10 +411,11 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = 2048; else pScrn->videoRam = 4096; - } + } - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %d bytes video ram\n", - pScrn->videoRam); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %d bytes video ram\n", + pScrn->videoRam); + } /* try to detect the RAMDAC */ { @@ -491,15 +489,12 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags) return TRUE; } -} static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ARKPtr pARK = ARKPTR(pScrn); - BoxRec MemBox; - int i; pScrn->fbOffset = 0; @@ -530,11 +525,15 @@ static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, return FALSE; } + miSetPixmapDepths (); + if (!fbScreenInit(pScreen, pARK->FBBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -1131,7 +1130,7 @@ static void ARKFreeScreen(int scrnIndex, int flags) } -static unsigned char get_daccomm() +static unsigned char get_daccomm(void) { unsigned char tmp; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile index 342e7f8cf..236e025cc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.25 2000/11/02 16:55:26 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.28 2001/01/24 00:06:15 dawes Exp $ XCOMM -XCOMM Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca +XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software and XCOMM its documentation for any purpose is hereby granted without fee, provided @@ -162,11 +162,9 @@ InstallObjectModule(r128,$(MODULEDIR),drivers) InstallObjectModule(radeon,$(MODULEDIR),drivers) #if 0 -CppManTarget(ati,) InstallModuleManPage(ati) #endif -CppManTarget(r128,) InstallModuleManPage(r128) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp deleted file mode 100644 index 7d7de05f0..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp,v 1.6 2000/12/11 20:18:06 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH ATI __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -ati \- ATI video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qati\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B ati -is an XFree86 driver for ATI video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B ati -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c index 6a8147fcd..42d52a061 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.4 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.5 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h index 7340def10..19bb85f49 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.2 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.3 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h index e19c4019f..3ca64947a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.4 2000/10/11 22:52:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.7 2001/02/12 03:31:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -46,10 +46,12 @@ * inm/outm 32-bit R/W through MMIO space. The register is specified as * the actual MMIO offset (with Block 1 following Block 0), which, * in this case, is equivalent to the register's IOPortTag from - * atiregs.h. Can only be used for those few non-FIFO'ed - * registers outside of Block 0's first 256 bytes. pATI->pBlock - * array elements must have been previously set up by - * ATIMapApertures(). + * atiregs.h. Can be used for those few non-FIFO'ed registers + * outside of Block 0's first 256 bytes. inm() can also be used + * for FIFO'ed registers if, and only if, it can be guaranteed to + * not have been previously FIFO'ed (e.g. when the engine is + * idle). pATI->pBlock array elements must have been previously + * set up by ATIMapApertures(). * * outf 32-bit write through MMIO cache. Identical to outm() but * intended for FIFO'ed registers. There is no inf() provided. @@ -166,11 +168,11 @@ extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); */ #define ATIMach64WaitForFIFO(_pATI, _n) \ while (pATI->nAvailableFIFOEntries < (_n)) \ - ATIMach64PollEngineStatus(pATI); + ATIMach64PollEngineStatus(pATI) #define ATIMach64WaitForIdle(_pATI) \ while (pATI->EngineIsBusy) \ - ATIMach64PollEngineStatus(pATI); + ATIMach64PollEngineStatus(pATI) extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, const Bool)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h index 8197d9c69..7dcbc079c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.6 2000/11/02 16:55:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.7 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp deleted file mode 100644 index da732b0bd..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp +++ /dev/null @@ -1,75 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp,v 1.3 2000/12/11 20:18:07 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH R128 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -r128 \- ATI Rage 128 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qr128\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B r128 -is an XFree86 driver for ATI Rage 128 based video cards. It contains -full support for 8, 15, 16 and 24 bit pixel depths, hardware -acceleration of drawing primitives, hardware cursor, video modes up to -1800x1440 @ 70Hz, doublescan modes (e.g., 320x200 and 320x240), gamma -correction at all pixel depths, a fully programming dot clock and robust -text mode restoration for VT switching. -.SH SUPPORTED HARDWARE -The -.B r128 -driver supports all ATI Rage 128 based video cards including the Rage -Fury AGP 32MB, the XPERT 128 AGP 16MB and the XPERT 99 AGP 8MB. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects all device information necessary to initialize -the card. However, if you have problems with auto-detection, you can -specify: -.PP -.RS 4 -VideoRam - in kilobytes -.br -MemBase - physical address of the linear framebuffer -.br -IOBase - physical address of the MMIO registers -.br -ChipID - PCI DEVICE ID -.RE -.PP -In addition, the following driver -.B Options -are supported: -.TP -.BI "Option \*qSWcursor\*q \*q" boolean \*q -Selects software cursor. The default is -.B off. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Enables or disables all hardware acceleration. The default is to -.B enable -hardware acceleration. -.TP -.BI "Option \*qDac6Bit\*q \*q" boolean \*q -Enables or disables the use of 6 bits per color component when in 8 bpp -mode (emulates VGA mode). By default, all 8 bits per color component -are used. The default is -.B off. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This overrides the default pixel value for the YUV video overlay key. -The default value is -.B undefined. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -.nf -Rickard E. (Rik) Faith \fIfaith@precisioninsight.com\fP -Kevin E. Martin \fIkevin@precisioninsight.com\fP diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h index 75d3e855c..003b9aa2e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.8 2000/12/08 19:15:33 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.10 2001/01/16 05:11:06 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -193,7 +193,6 @@ typedef struct { unsigned long LinearAddr; /* Frame buffer physical address */ unsigned long MMIOAddr; /* MMIO region physical address */ unsigned long BIOSAddr; /* BIOS physical address */ - Bool BIOSFromPCI; /* BIOS is read from PCI space */ unsigned char *MMIO; /* Map of MMIO region */ unsigned char *FB; /* Map of frame buffer */ @@ -203,8 +202,9 @@ typedef struct { unsigned long FbMapSize; /* Size of frame buffer, in bytes */ int Flags; /* Saved copy of mode flags */ + CARD8 BIOSDisplay; /* Device the BIOS is set to display to */ + Bool HasPanelRegs; /* Current chip can connect to a FP */ - Bool CRTOnly; /* Only use External CRT instead of FP */ CARD8 *VBIOS; /* Video BIOS for mode validation on FPs */ int FPBIOSstart; /* Start of the flat panel info */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c index 6a2d75aef..6cc71a9ce 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.6 2000/12/22 05:27:45 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -77,7 +77,6 @@ * */ -#define R128_IMAGEWRITE 0 /* Disable ImageWrites - faster in software */ #define R128_TRAPEZOIDS 0 /* Trapezoids don't work */ /* Driver data structures */ @@ -149,7 +148,8 @@ void R128EngineReset(ScrnInfoPtr pScrn) OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI); INREG(R128_GEN_RESET_CNTL); - OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl & ~R128_SOFT_RESET_GUI); + OUTREG(R128_GEN_RESET_CNTL, + gen_reset_cntl & (CARD32)(~R128_SOFT_RESET_GUI)); INREG(R128_GEN_RESET_CNTL); OUTPLL(R128_MCLK_CNTL, mclk_cntl); @@ -870,7 +870,6 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) x11perf -putimage100 2150.0/sec 1170.0/sec x11perf -putimage500 108.0/sec 49.8/sec */ -#if R128_IMAGEWRITE static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -1003,7 +1002,6 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) } } } -#endif /* Initialize the acceleration hardware. */ void R128EngineInit(ScrnInfoPtr pScrn) @@ -1155,7 +1153,6 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) | LINE_PATTERN_POWER_OF_2_ONLY); /* ImageWrite */ -#if R128_IMAGEWRITE a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; info->scratch_buffer[0] = info->scratch_save; @@ -1169,7 +1166,6 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) | LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | SCANLINE_PAD_DWORD; -#endif } /* Initialize XAA for supported acceleration and also initialize the diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c index e7bbd37ec..44b90300e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.3 2000/11/18 19:37:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.4 2000/12/22 05:27:45 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -113,7 +113,7 @@ static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) CARD32 save; save = INREG(R128_CRTC_GEN_CNTL); - OUTREG(R128_CRTC_GEN_CNTL, save & ~R128_CRTC_CUR_EN); + OUTREG(R128_CRTC_GEN_CNTL, save & (CARD32)~R128_CRTC_CUR_EN); #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c index 5d55ad114..e33168311 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.7 2000/12/12 17:17:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.9 2001/01/08 01:07:34 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h index 01857a0e3..070a3751d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.5 2001/01/08 01:07:34 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c index b879ae9c5..5b86c33d3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.13 2000/12/08 19:15:33 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.22 2001/02/15 11:03:56 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -140,6 +140,7 @@ typedef enum { /* FIXME: Disable CRTOnly until it is tested */ OPTION_CRT, #endif + OPTION_BIOS_DISPLAY, OPTION_PANEL_WIDTH, OPTION_PANEL_HEIGHT, OPTION_PROG_FP_REGS, @@ -164,10 +165,7 @@ OptionInfoRec R128Options[] = { { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_USE_CCE_2D, "UseCCEfor2D", OPTV_BOOLEAN, {0}, FALSE }, #endif -#if USE_CRT_ONLY - /* FIXME: Disable CRTOnly until it is tested */ - { OPTION_CRT, "CRTOnly", OPTV_BOOLEAN, {0}, FALSE }, -#endif + { OPTION_BIOS_DISPLAY, "UseBIOSDisplay", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE }, { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE }, { OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE }, @@ -297,6 +295,10 @@ static const char *drmSymbols[] = { "drmMarkBufs", "drmR128CleanupCCE", "drmR128InitCCE", + "drmR128ResetCCE", + "drmR128StartCCE", + "drmR128StopCCE", + "drmR128WaitForIdleCCE", "drmUnmap", "drmUnmapBufs", NULL @@ -501,17 +503,12 @@ static int R128Div(int n, int d) } /* Read the Video BIOS block and the FP registers (if applicable). */ -static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn) +static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { R128InfoPtr info = R128PTR(pScrn); int i; int FPHeader = 0; -#define R128ReadBIOS(offset, buffer, length) \ - (info->BIOSFromPCI ? \ - xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \ - xf86ReadBIOS(info->BIOSAddr, offset, buffer, length)) - #define R128_BIOS8(v) (info->VBIOS[v]) #define R128_BIOS16(v) (info->VBIOS[v] | \ (info->VBIOS[(v) + 1] << 8)) @@ -526,16 +523,20 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn) return FALSE; } - info->BIOSFromPCI = TRUE; - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Video BIOS not detected in PCI space!\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Attempting to read Video BIOS from legacy ISA space!\n"); - info->BIOSFromPCI = FALSE; - info->BIOSAddr = 0x000c0000; - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); + if (pInt10) { + info->BIOSAddr = pInt10->BIOSseg << 4; + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), + R128_VBIOS_SIZE); + } else { + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, R128_VBIOS_SIZE); + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Video BIOS not detected in PCI space!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Attempting to read Video BIOS from legacy ISA space!\n"); + info->BIOSAddr = 0x000c0000; + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, R128_VBIOS_SIZE); + } } if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { info->BIOSAddr = 0x00000000; @@ -893,23 +894,41 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PF: default: info->HasPanelRegs = FALSE; break; } } /* Read registers used to determine options */ - from = X_PROBED; + from = X_PROBED; R128MapMMIO(pScrn); - R128MMIO = info->MMIO; + R128MMIO = info->MMIO; + if (info->FBDev) - pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; + pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; else - pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024; - info->MemCntl = INREG(R128_MEM_CNTL); + pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024; - info->BusCntl = INREG(R128_BUS_CNTL); - R128MMIO = NULL; + info->MemCntl = INREG(R128_MEM_CNTL); + info->BusCntl = INREG(R128_BUS_CNTL); + + /* On non-flat panel systems, the default is to display to the CRT, + and on flat panel systems, the default is to display to the flat + panel unless the user explicity enables displaying to the device + initialized in the BIOS via the "UseBIOSDisplay" config file + setting. BIOS_5_SCRATCH holds the display device on flat panel + systems only. */ + if (info->HasPanelRegs) { + if (xf86ReturnOptValBool(R128Options, OPTION_BIOS_DISPLAY, FALSE)) + info->BIOSDisplay = INREG8(R128_BIOS_5_SCRATCH); + else + info->BIOSDisplay = R128_BIOS_DISPLAY_FP; + } else { + info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; + } + + R128MMIO = NULL; R128UnmapMMIO(pScrn); /* RAM */ @@ -949,22 +968,21 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) /* Flat panel (part 2) */ if (info->HasPanelRegs) { -#if !USE_CRT_ONLY - info->CRTOnly = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); -#else - /* Panel CRT mode override */ - if ((info->CRTOnly = xf86ReturnOptValBool(R128Options, - OPTION_CRT, FALSE))) { + switch (info->BIOSDisplay) { + case R128_BIOS_DISPLAY_FP: xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using external CRT instead of " - "flat panel for display\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using flat panel for display\n"); + break; + case R128_BIOS_DISPLAY_CRT: + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using external CRT for display\n"); + break; + case R128_BIOS_DISPLAY_FP_CRT: + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using both flat panel and external CRT " + "for display\n"); + break; } -#endif /* Panel width/height overrides */ info->PanelXRes = 0; @@ -979,8 +997,6 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel height: %d\n", info->PanelYRes); } - } else { - info->CRTOnly = FALSE; } #ifdef XF86DRI @@ -992,7 +1008,8 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) switch (info->Chipset) { case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128RE: - case PCI_CHIP_RAGE128RK: info->IsPCI = TRUE; break; + case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128PD: info->IsPCI = TRUE; break; case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: case PCI_CHIP_RAGE128ML: @@ -1008,7 +1025,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) return TRUE; } -static Bool R128PreInitDDC(ScrnInfoPtr pScrn) +static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { R128InfoPtr info = R128PTR(pScrn); vbeInfoPtr pVbe; @@ -1016,15 +1033,15 @@ static Bool R128PreInitDDC(ScrnInfoPtr pScrn) if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; xf86LoaderReqSymLists(ddcSymbols, NULL); -#if defined(__powerpc__) - /* Int10 is broken on PPC */ +#if defined(__powerpc__) || defined(__alpha__) + /* Int10 is broken on PPC and some Alphas */ return TRUE; #else if (xf86LoadSubModule(pScrn, "vbe")) { #ifdef XFree86LOADER xf86LoaderReqSymLists(vbeSymbols,NULL); #endif - pVbe = VBEInit(NULL,info->pEnt->index); + pVbe = VBEInit(pInt10,info->pEnt->index); if (!pVbe) return FALSE; xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); @@ -1124,10 +1141,8 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn) if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); #endif -#endif info->CurrentLayout.displayWidth = pScrn->displayWidth; info->CurrentLayout.mode = pScrn->currentMode; @@ -1153,15 +1168,14 @@ static Bool R128PreInitAccel(ScrnInfoPtr pScrn) return TRUE; } -static Bool R128PreInitInt10(ScrnInfoPtr pScrn) +static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { R128InfoPtr info = R128PTR(pScrn); -#if 1 +#if 1 && !defined(__alpha__) + /* int10 is broken on some Alphas */ if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(info->pEnt->index); - xf86FreeInt10(pInt); + *ppInt10 = xf86InitInt10(info->pEnt->index); } #endif return TRUE; @@ -1294,7 +1308,8 @@ R128ProbeDDC(ScrnInfoPtr pScrn, int indx) /* R128PreInit is called once at server startup. */ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) { - R128InfoPtr info; + R128InfoPtr info; + xf86Int10InfoPtr pInt10 = NULL; R128TRACE(("R128PreInit\n")); @@ -1358,7 +1373,7 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR; pScrn->monitor = pScrn->confScreen->monitor; if (!R128PreInitVisual(pScrn)) goto fail; @@ -1401,26 +1416,26 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) } if (!info->FBDev) - if (!R128PreInitInt10(pScrn)) goto fail; + if (!R128PreInitInt10(pScrn, &pInt10)) goto fail; - if (!R128PreInitConfig(pScrn)) goto fail; + if (!R128PreInitConfig(pScrn)) goto fail; - if (!R128GetBIOSParameters(pScrn)) goto fail; + if (!R128GetBIOSParameters(pScrn, pInt10)) goto fail; - if (!R128GetPLLParameters(pScrn)) goto fail; + if (!R128GetPLLParameters(pScrn)) goto fail; - if (!R128PreInitDDC(pScrn)) goto fail; + if (!R128PreInitDDC(pScrn, pInt10)) goto fail; - if (!R128PreInitGamma(pScrn)) goto fail; + if (!R128PreInitGamma(pScrn)) goto fail; - if (!R128PreInitModes(pScrn)) goto fail; + if (!R128PreInitModes(pScrn)) goto fail; - if (!R128PreInitCursor(pScrn)) goto fail; + if (!R128PreInitCursor(pScrn)) goto fail; - if (!R128PreInitAccel(pScrn)) goto fail; + if (!R128PreInitAccel(pScrn)) goto fail; #ifdef XF86DRI - if (!R128PreInitDRI(pScrn)) goto fail; + if (!R128PreInitDRI(pScrn)) goto fail; #endif /* Free the video bios (if applicable) */ @@ -1429,6 +1444,10 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + return TRUE; fail: @@ -1440,6 +1459,10 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + vgaHWFreeHWRec(pScrn); R128FreeRec(pScrn); return FALSE; @@ -1591,9 +1614,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #else switch (pScrn->bitsPerPixel) { case 8: @@ -1928,10 +1949,8 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) )) return FALSE; /* DPMS setup */ -#ifdef DPMSExtension - if (!info->HasPanelRegs || info->CRTOnly) + if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0); -#endif R128InitVideo(pScreen); @@ -2036,7 +2055,8 @@ static void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore) OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } else { if (restore->lvds_gen_cntl & (R128_LVDS_ON | R128_LVDS_BLON)) { - OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl & ~R128_LVDS_BLON); + OUTREG(R128_LVDS_GEN_CNTL, + restore->lvds_gen_cntl & (CARD32)~R128_LVDS_BLON); usleep(R128PTR(pScrn)->PanelPwrDly * 1000); OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } else { @@ -2141,7 +2161,7 @@ static void R128RestoreMode(ScrnInfoPtr pScrn, R128SavePtr restore) R128RestoreCrtcRegisters(pScrn, restore); if (info->HasPanelRegs) R128RestoreFPRegisters(pScrn, restore); - if (!info->HasPanelRegs || info->CRTOnly) + if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) R128RestorePLLRegisters(pScrn, restore); R128RestoreDDARegisters(pScrn, restore); R128RestorePalette(pScrn, restore); @@ -2366,15 +2386,24 @@ static Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save, case 32: format = 6; bytpp = 4; break; /* xRGB */ default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + "Unsupported pixel depth (%d)\n", + info->CurrentLayout.bitsPerPixel); return FALSE; } R128TRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); - if (info->HasPanelRegs) - if (info->CRTOnly) hsync_fudge = hsync_fudge_fp_crt[format-1]; - else hsync_fudge = hsync_fudge_fp[format-1]; - else hsync_fudge = hsync_fudge_default[format-1]; + switch (info->BIOSDisplay) { + case R128_BIOS_DISPLAY_FP: + hsync_fudge = hsync_fudge_fp[format-1]; + break; + case R128_BIOS_DISPLAY_FP_CRT: + hsync_fudge = hsync_fudge_fp_crt[format-1]; + break; + case R128_BIOS_DISPLAY_CRT: + default: + hsync_fudge = hsync_fudge_default[format-1]; + break; + } save->crtc_gen_cntl = (R128_CRTC_EXT_DISP_EN | R128_CRTC_EN @@ -2456,7 +2485,7 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, int yres = mode->CrtcVDisplay; float Hratio, Vratio; - if (info->CRTOnly) { + if (info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) { save->crtc_ext_cntl |= R128_CRTC_CRT_ON; save->crtc2_gen_cntl = 0; save->fp_gen_cntl = orig->fp_gen_cntl; @@ -2467,9 +2496,9 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, R128_FP_USE_SHADOW_EN); save->fp_gen_cntl |= (R128_FP_SEL_CRTC2 | R128_FP_CRTC_DONT_SHADOW_VPAR); - save->fp_panel_cntl = orig->fp_panel_cntl & ~R128_FP_DIGON; - save->lvds_gen_cntl = orig->lvds_gen_cntl & ~(R128_LVDS_ON | - R128_LVDS_BLON); + save->fp_panel_cntl = orig->fp_panel_cntl & (CARD32)~R128_FP_DIGON; + save->lvds_gen_cntl = orig->lvds_gen_cntl & + (CARD32)~(R128_LVDS_ON | R128_LVDS_BLON); return; } @@ -2502,11 +2531,12 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, else save->fp_vert_stretch |= (R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND); - save->fp_gen_cntl = (orig->fp_gen_cntl & ~(R128_FP_SEL_CRTC2 | - R128_FP_CRTC_USE_SHADOW_VEND | - R128_FP_CRTC_HORZ_DIV2_EN | - R128_FP_CRTC_HOR_CRT_DIV2_DIS | - R128_FP_USE_SHADOW_EN)); + save->fp_gen_cntl = (orig->fp_gen_cntl & + (CARD32)~(R128_FP_SEL_CRTC2 | + R128_FP_CRTC_USE_SHADOW_VEND | + R128_FP_CRTC_HORZ_DIV2_EN | + R128_FP_CRTC_HOR_CRT_DIV2_DIS | + R128_FP_USE_SHADOW_EN)); if (orig->fp_gen_cntl & R128_FP_DETECT_SENSE) { save->fp_gen_cntl |= (R128_FP_CRTC_DONT_SHADOW_VPAR | R128_FP_TDMS_EN); @@ -2522,9 +2552,13 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, want to use the dual CRTC capabilities of the R128 to allow both the flat panel and external CRT to either simultaneously display the same image or display two different images. */ - save->crtc_ext_cntl &= ~R128_CRTC_CRT_ON; - save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2; - save->crtc2_gen_cntl = 0; + if (info->BIOSDisplay == R128_BIOS_DISPLAY_FP_CRT) { + save->crtc_ext_cntl |= R128_CRTC_CRT_ON; + } else { + save->crtc_ext_cntl &= ~R128_CRTC_CRT_ON; + save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2; + save->crtc2_gen_cntl = 0; + } /* WARNING: Be careful about turning on the flat panel */ #if 1 @@ -2782,7 +2816,9 @@ int R128ValidMode(int scrnIndex, DisplayModePtr mode, if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; } - if (info->HasPanelRegs && !info->CRTOnly && info->VBIOS) { + if (info->HasPanelRegs && + info->BIOSDisplay != R128_BIOS_DISPLAY_CRT && + info->VBIOS) { int i; for (i = info->FPBIOSstart+64; R128_BIOS16(i) != 0; i += 2) { int j = R128_BIOS16(i); @@ -2974,7 +3010,6 @@ void R128FreeScreen(int scrnIndex, int flags) R128FreeRec(pScrn); } -#ifdef DPMSExtension /* Sets VESA Display Power Management Signaling (DPMS) Mode. */ static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -3006,4 +3041,3 @@ static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, break; } } -#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c index 23a618bd1..520ec36d9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.6 2000/12/13 02:45:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.8 2001/02/12 04:24:24 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -54,6 +54,7 @@ SymTabRec R128Chipsets[] = { { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" }, { PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" }, { PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" }, + { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (PCI)" }, { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" }, { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility LE (PCI)" }, { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility LF (AGP)" }, @@ -68,6 +69,7 @@ PciChipsets R128PciChipsets[] = { { PCI_CHIP_RAGE128RG, PCI_CHIP_RAGE128RG, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RK, PCI_CHIP_RAGE128RK, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RL, PCI_CHIP_RAGE128RL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PD, PCI_CHIP_RAGE128PD, RES_SHARED_VGA }, { PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LE, PCI_CHIP_RAGE128LE, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LF, PCI_CHIP_RAGE128LF, RES_SHARED_VGA }, @@ -86,6 +88,8 @@ R128AvailableOptions(int chipid, int busid) * Return options defined in the r128 submodule which will have been * loaded by this point. */ + if ((chipid >> 16) == PCI_VENDOR_ATI) + chipid -= PCI_VENDOR_ATI << 16; for (i = 0; R128PciChipsets[i].PCIid > 0; i++) { if (chipid == R128PciChipsets[i].PCIid) return R128Options; @@ -159,7 +163,7 @@ R128Probe(DriverPtr drv, int flags) pEnt = xf86GetEntityInfo(usedChips[i]); if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER if (!xf86LoadSubModule(pScrn, "r128")) { @@ -171,6 +175,7 @@ R128Probe(DriverPtr drv, int flags) xf86LoaderReqSymLists(R128Symbols, NULL); +#ifndef ELFDEBUG /* Workaround for possible loader bug */ # define R128PreInit \ (xf86PreInitProc*) LoaderSymbol("R128PreInit") @@ -188,6 +193,7 @@ R128Probe(DriverPtr drv, int flags) (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen") # define R128ValidMode \ (xf86ValidModeProc*) LoaderSymbol("R128ValidMode") +#endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h index 98aea68b6..e9d584ab9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.6 2000/12/12 17:17:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.9 2001/01/16 05:11:07 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -116,12 +116,12 @@ #define PAL_SELECT(idx) \ do { \ + CARD32 tmp = INREG(R128_DAC_CNTL); \ if (idx) { \ - OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) | \ - R128_DAC_PALETTE_ACC_CTL); \ + OUTREG(R128_DAC_CNTL, tmp | R128_DAC_PALETTE_ACC_CTL); \ } else { \ - OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) & \ - ~R128_DAC_PALETTE_ACC_CTL); \ + OUTREG(R128_DAC_CNTL, tmp & \ + (CARD32)~R128_DAC_PALETTE_ACC_CTL); \ } \ } while (0) @@ -182,6 +182,13 @@ #define R128_BIOS_1_SCRATCH 0x0014 #define R128_BIOS_2_SCRATCH 0x0018 #define R128_BIOS_3_SCRATCH 0x001c +#define R128_BIOS_4_SCRATCH 0x0020 +#define R128_BIOS_5_SCRATCH 0x0024 +# define R128_BIOS_DISPLAY_FP (1 << 0) +# define R128_BIOS_DISPLAY_CRT (2 << 0) +# define R128_BIOS_DISPLAY_FP_CRT (3 << 0) +#define R128_BIOS_6_SCRATCH 0x0028 +#define R128_BIOS_7_SCRATCH 0x002c #define R128_BIOS_ROM 0x0f30 /* PCI */ #define R128_BIST 0x0f0f /* PCI */ #define R128_BRUSH_DATA0 0x1480 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h index 54bfa3673..b4ffaf8f9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.5 2000/12/15 22:48:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.6 2001/01/08 01:07:35 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c index 16a446bc7..f532e15cd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.14 2000/12/07 20:42:52 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.17 2001/01/25 02:26:00 mvojkovi Exp $ */ #include "r128.h" #include "r128_reg.h" @@ -398,6 +398,7 @@ R128SetPortAttribute( if((value < -64) || (value > 63)) return BadValue; pPriv->brightness = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | (pPriv->saturation << 8) | (pPriv->saturation << 16)); @@ -406,6 +407,7 @@ R128SetPortAttribute( if((value < 0) || (value > 31)) return BadValue; pPriv->saturation = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | (pPriv->saturation << 8) | (pPriv->saturation << 16)); @@ -460,13 +462,18 @@ R128QueryBestSize( unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 4)) + drw_w = vid_w >> 4; + if(vid_h > (drw_h << 4)) + drw_h = vid_h >> 4; + *p_w = drw_w; *p_h = drw_h; } static void -R128CopyData( +R128CopyData422( unsigned char *src, unsigned char *dst, int srcPitch, @@ -483,47 +490,44 @@ R128CopyData( } static void -R128CopyMungedData( +R128CopyData420( unsigned char *src1, unsigned char *src2, unsigned char *src3, unsigned char *dst1, + unsigned char *dst2, + unsigned char *dst3, int srcPitch, int srcPitch2, int dstPitch, int h, int w ){ - CARD32 *dst; - CARD8 *s1, *s2, *s3; - int i, j; + int count; - w >>= 1; + count = h; + while(count--) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch; + } - for(j = 0; j < h; j++) { - dst = (CARD32*)dst1; - s1 = src1; s2 = src2; s3 = src3; - i = w; - while(i > 4) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); - dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); - dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); - dst += 4; s2 += 4; s3 += 4; s1 += 8; - i -= 4; - } - while(i--) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst++; s2++; s3++; - s1 += 2; - } + w >>= 1; + h >>= 1; + dstPitch >>= 1; + + count = h; + while(count--) { + memcpy(dst2, src2, w); + src2 += srcPitch2; + dst2 += dstPitch; + } - dst1 += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } + count = h; + while(count--) { + memcpy(dst3, src3, w); + src3 += srcPitch2; + dst3 += dstPitch; } } @@ -570,7 +574,7 @@ R128AllocateMemory( } static void -R128DisplayVideo( +R128DisplayVideo422( ScrnInfoPtr pScrn, int id, int offset, @@ -613,7 +617,6 @@ R128DisplayVideo( left = (left >> 16) & 7; - OUTREG(R128_OV0_REG_LOAD_CNTL, 1); while(!(INREG(R128_OV0_REG_LOAD_CNTL) & (1 << 3))); @@ -624,23 +627,103 @@ R128DisplayVideo( OUTREG(R128_OV0_V_INC, v_inc); OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE, pitch); - OUTREG(R128_OV0_P1_X_START_END, (src_w + left - 1) | (left << 16)); - left >>= 1; src_w >>= 1; - OUTREG(R128_OV0_P2_X_START_END, (src_w + left - 1) | (left << 16)); - OUTREG(R128_OV0_P3_X_START_END, (src_w + left - 1) | (left << 16)); + OUTREG(R128_OV0_P1_X_START_END, (width - 1) | (left << 16)); + left >>= 1; width >>= 1; + OUTREG(R128_OV0_P2_X_START_END, (width - 1) | (left << 16)); + OUTREG(R128_OV0_P3_X_START_END, (width - 1) | (left << 16)); OUTREG(R128_OV0_VID_BUF0_BASE_ADRS, offset & 0xfffffff0); OUTREG(R128_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); + OUTREG(R128_OV0_P23_V_ACCUM_INIT, 0); OUTREG(R128_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); OUTREG(R128_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); if(id == FOURCC_UYVY) - OUTREG(R128_OV0_SCALE_CNTL, 0x41008C03); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8C03); else - OUTREG(R128_OV0_SCALE_CNTL, 0x41008B03); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8B03); OUTREG(R128_OV0_REG_LOAD_CNTL, 0); } +static void +R128DisplayVideo420( + ScrnInfoPtr pScrn, + short width, short height, + int pitch, + int offset1, int offset2, int offset3, + int left, int right, int top, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + int v_inc, h_inc, step_by, tmp, leftUV; + int p1_h_accum_init, p23_h_accum_init; + int p1_v_accum_init, p23_v_accum_init; + + v_inc = (src_h << 20) / drw_h; + h_inc = (src_w << 12) / drw_w; + step_by = 1; + + while(h_inc >= (2 << 12)) { + step_by++; + h_inc >>= 1; + } + + /* keep everything in 16.16 */ + + offset1 += (left >> 16) & ~15; + offset2 += (left >> 17) & ~15; + offset3 += (left >> 17) & ~15; + + tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3); + p1_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0xf0000000); + + tmp = ((left >> 1) & 0x0001ffff) + 0x00028000 + (h_inc << 2); + p23_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0x70000000); + + tmp = (top & 0x0000ffff) + 0x00018000; + p1_v_accum_init = ((tmp << 4) & 0x03ff8000) | 0x00000001; + + tmp = ((top >> 1) & 0x0000ffff) + 0x00018000; + p23_v_accum_init = ((tmp << 4) & 0x01ff8000) | 0x00000001; + + leftUV = (left >> 17) & 15; + left = (left >> 16) & 15; + + OUTREG(R128_OV0_REG_LOAD_CNTL, 1); + while(!(INREG(R128_OV0_REG_LOAD_CNTL) & (1 << 3))); + + OUTREG(R128_OV0_H_INC, h_inc | ((h_inc >> 1) << 16)); + OUTREG(R128_OV0_STEP_BY, step_by | (step_by << 8)); + OUTREG(R128_OV0_Y_X_START, dstBox->x1 | (dstBox->y1 << 16)); + OUTREG(R128_OV0_Y_X_END, dstBox->x2 | (dstBox->y2 << 16)); + OUTREG(R128_OV0_V_INC, v_inc); + OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); + src_h = (src_h + 1) >> 1; + OUTREG(R128_OV0_P23_BLANK_LINES_AT_TOP, 0x000007ff | ((src_h - 1) << 16)); + OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE, pitch); + OUTREG(R128_OV0_VID_BUF_PITCH1_VALUE, pitch >> 1); + OUTREG(R128_OV0_P1_X_START_END, (width - 1) | (left << 16)); + width >>= 1; + OUTREG(R128_OV0_P2_X_START_END, (width - 1) | (leftUV << 16)); + OUTREG(R128_OV0_P3_X_START_END, (width - 1) | (leftUV << 16)); + OUTREG(R128_OV0_VID_BUF0_BASE_ADRS, offset1 & 0xfffffff0); + OUTREG(R128_OV0_VID_BUF1_BASE_ADRS, (offset2 & 0xfffffff0) | 0x00000001); + OUTREG(R128_OV0_VID_BUF2_BASE_ADRS, (offset3 & 0xfffffff0) | 0x00000001); + OUTREG(R128_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); + OUTREG(R128_OV0_P23_V_ACCUM_INIT, p23_v_accum_init); + OUTREG(R128_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); + OUTREG(R128_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8A03); + + OUTREG(R128_OV0_REG_LOAD_CNTL, 0); +} + + static int R128PutImage( @@ -657,27 +740,28 @@ R128PutImage( R128InfoPtr info = R128PTR(pScrn); R128PortPrivPtr pPriv = (R128PortPrivPtr)data; INT32 xa, xb, ya, yb; - unsigned char *dst_start; - int pitch, new_size, offset, s2offset, s3offset; + int pitch, new_size, offset, s1offset, s2offset, s3offset; int srcPitch, srcPitch2, dstPitch; + int d1line, d2line, d3line, d1offset, d2offset, d3offset; int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; /* - * s2offset, s3offset - byte offsets into U and V plane of the - * source where copying starts. Y plane is - * done by editing "buf". + * s1offset, s2offset, s3offset - byte offsets to the Y, U and V planes + * of the source. + * + * d1offset, d2offset, d3offset - byte offsets to the Y, U and V planes + * of the destination. * - * offset - byte offset to the first line of the destination. + * offset - byte offset within the framebuffer to where the destination + * is stored. * - * dst_start - byte address to the first displayed pel. + * d1line, d2line, d3line - byte offsets within the destination to the + * first displayed scanline in each plane. * */ - /* make the compiler happy */ - s2offset = s3offset = srcPitch2 = 0; - if(src_w > (drw_w << 4)) drw_w = src_w >> 4; if(src_h > (drw_h << 4)) @@ -708,19 +792,24 @@ R128PutImage( switch(id) { case FOURCC_YV12: case FOURCC_I420: - dstPitch = ((width << 1) + 15) & ~15; - new_size = ((dstPitch * height) + bpp - 1) / bpp; srcPitch = (width + 3) & ~3; - s2offset = srcPitch * height; srcPitch2 = ((width >> 1) + 3) & ~3; + dstPitch = (width + 31) & ~31; /* of luma */ + new_size = ((dstPitch * (height + (height >> 1))) + bpp - 1) / bpp; + s1offset = 0; + s2offset = srcPitch * height; s3offset = (srcPitch2 * (height >> 1)) + s2offset; break; case FOURCC_UYVY: case FOURCC_YUY2: default: + srcPitch = width << 1; + srcPitch2 = 0; dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; - srcPitch = (width << 1); + s1offset = 0; + s2offset = 0; + s3offset = 0; break; } @@ -737,37 +826,52 @@ R128PutImage( left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; - offset = (pPriv->linear->offset * bpp) + (top * dstPitch); + offset = pPriv->linear->offset * bpp; if(pPriv->doubleBuffer) offset += pPriv->currentBuffer * new_size * bpp; - dst_start = info->FB + offset; switch(id) { case FOURCC_YV12: case FOURCC_I420: + d1line = top * dstPitch; + d2line = (height * dstPitch) + ((top >> 1) * (dstPitch >> 1)); + d3line = d2line + ((height >> 1) * (dstPitch >> 1)); + top &= ~1; - dst_start += left << 1; + + d1offset = (top * dstPitch) + left + offset; + d2offset = d2line + (left >> 1) + offset; + d3offset = d3line + (left >> 1) + offset; + + s1offset += (top * srcPitch) + left; tmp = ((top >> 1) * srcPitch2) + (left >> 1); s2offset += tmp; s3offset += tmp; - if(id == FOURCC_I420) { + if(id == FOURCC_YV12) { tmp = s2offset; s2offset = s3offset; s3offset = tmp; } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - R128CopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, - buf + s3offset, dst_start, srcPitch, srcPitch2, - dstPitch, nlines, npixels); + R128CopyData420(buf + s1offset, buf + s2offset, buf + s3offset, + info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: default: left <<= 1; - buf += (top * srcPitch) + left; + d1line = top * dstPitch; + d2line = 0; + d3line = 0; + d1offset = d1line + left + offset; + d2offset = 0; + d3offset = 0; + s1offset += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; - dst_start += left; - R128CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + R128CopyData422(buf + s1offset, info->FB + d1offset, + srcPitch, dstPitch, nlines, npixels); break; } @@ -776,13 +880,27 @@ R128PutImage( if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, + (CARD32)~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } - R128DisplayVideo(pScrn, id, offset, width, height, dstPitch, + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + R128DisplayVideo420(pScrn, width, height, dstPitch, + offset + d1line, offset + d2line, offset + d3line, + xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + R128DisplayVideo422(pScrn, id, offset + d1line, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + break; + } pPriv->videoStatus = CLIENT_VIDEO_ON; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index 911122b21..6916a0c13 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.8 2000/12/08 14:41:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.13 2001/01/21 21:19:19 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -66,10 +66,6 @@ #define RADEON_DEBUG 0 /* Turn off debugging output */ #define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ #define RADEON_MMIOSIZE 0x80000 -/* Atomic updates of PLL clock don't seem to always work and stick, thus - * the bit never resets. Here - we use our own check by reading back the - * register we've just wrote to make sure it's got the Right! value */ -#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */ #define RADEON_VBIOS_SIZE 0x00010000 @@ -201,7 +197,6 @@ typedef struct { unsigned long LinearAddr; /* Frame buffer physical address */ unsigned long MMIOAddr; /* MMIO region physical address */ unsigned long BIOSAddr; /* BIOS physical address */ - Bool BIOSFromPCI; /* BIOS is read from PCI space */ unsigned char *MMIO; /* Map of MMIO region */ unsigned char *FB; /* Map of frame buffer */ @@ -293,6 +288,8 @@ typedef struct { unsigned char *AGP; /* Map */ int agpMode; + CARD32 pciCommand; + Bool CPInUse; /* CP has been used by X server */ int CPMode; /* CP mode that server/clients use */ int CPFifoSize; /* Size of the CP command FIFO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c index 0f8042853..b6b20af54 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.4 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.9 2001/01/21 21:19:20 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -70,8 +70,6 @@ * */ -#define RADEON_IMAGEWRITE 0 /* Turned off by default - slower in accel */ - /* Driver data structures */ #include "radeon.h" #include "radeon_reg.h" @@ -255,7 +253,7 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) RADEON_SOFT_RESET_RB | RADEON_SOFT_RESET_HDP); INREG(RADEON_RBBM_SOFT_RESET); - OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & + OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & (CARD32) ~(RADEON_SOFT_RESET_CP | RADEON_SOFT_RESET_HI | RADEON_SOFT_RESET_SE | @@ -785,7 +783,6 @@ static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) } } -#if RADEON_IMAGEWRITE /* Setup for XAA indirect image write. */ static void RADEONSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, @@ -898,7 +895,6 @@ static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) } } } -#endif /* ================================================================ @@ -1256,7 +1252,6 @@ static void RADEONMMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED | LINE_PATTERN_POWER_OF_2_ONLY); -#if RADEON_IMAGEWRITE /* ImageWrite */ a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; @@ -1275,7 +1270,6 @@ static void RADEONMMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) | SCANLINE_PAD_DWORD | LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#endif #if 0 /* Color 8x8 Pattern Fill */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c index 0847b46f8..fe218e760 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.3 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.4 2000/12/22 05:27:47 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -115,7 +115,7 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) CARD32 save; save = INREG(RADEON_CRTC_GEN_CNTL); - OUTREG(RADEON_CRTC_GEN_CNTL, save & ~RADEON_CRTC_CUR_EN); + OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c index dae4d873c..cc4c1d3bf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.8 2000/12/08 14:40:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.15 2001/01/22 02:16:49 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -493,7 +493,7 @@ static int RADEONDiv(int n, int d) } /* Read the Video BIOS block and the FP registers (if applicable). */ -static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn) +static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); #ifdef ENABLE_FLAT_PANEL @@ -520,16 +520,20 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn) return FALSE; } - info->BIOSFromPCI = TRUE; - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Video BIOS not detected in PCI space!\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Attempting to read Video BIOS from legacy ISA space!\n"); - info->BIOSFromPCI = FALSE; - info->BIOSAddr = 0x000c0000; - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); + if (pInt10) { + info->BIOSAddr = pInt10->BIOSseg << 4; + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), + RADEON_VBIOS_SIZE); + } else { + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Video BIOS not detected in PCI space!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Attempting to read Video BIOS from legacy ISA space!\n"); + info->BIOSAddr = 0x000c0000; + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); + } } if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { info->BIOSAddr = 0x00000000; @@ -950,7 +954,7 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) return TRUE; } -static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn) +static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); vbeInfoPtr pVbe; @@ -958,7 +962,7 @@ static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn) if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; xf86LoaderReqSymLists(ddcSymbols, NULL); if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,info->pEnt->index); + pVbe = VBEInit(pInt10, info->pEnt->index); if (!pVbe) return FALSE; xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); @@ -1056,10 +1060,8 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); #endif -#endif info->CurrentLayout.displayWidth = pScrn->displayWidth; info->CurrentLayout.mode = pScrn->currentMode; @@ -1085,15 +1087,13 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) return TRUE; } -static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn) +static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(info->pEnt->index); - xf86FreeInt10(pInt); + *ppInt10 = xf86InitInt10(info->pEnt->index); } return TRUE; } @@ -1152,7 +1152,7 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) if (xf86GetOptValInteger(RADEONOptions, OPTION_RING_SIZE, &(info->ringSize))) { - if (info->ringSize < 1 || info->ringSize >= info->agpSize) { + if (info->ringSize < 1 || info->ringSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Illegal ring buffer size: %d MB\n", info->ringSize); @@ -1179,7 +1179,7 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) } if (info->ringSize + info->bufSize + info->agpTexSize > - info->agpSize) { + (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Buffers are too big for requested AGP space\n"); return FALSE; @@ -1219,7 +1219,8 @@ RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) /* RADEONPreInit is called once at server startup. */ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) { - RADEONInfoPtr info; + RADEONInfoPtr info; + xf86Int10InfoPtr pInt10 = NULL; #ifdef XFree86LOADER /* @@ -1313,26 +1314,26 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) } if (!info->FBDev) - if (!RADEONPreInitInt10(pScrn)) goto fail; + if (!RADEONPreInitInt10(pScrn, &pInt10)) goto fail; - if (!RADEONPreInitConfig(pScrn)) goto fail; + if (!RADEONPreInitConfig(pScrn)) goto fail; - if (!RADEONGetBIOSParameters(pScrn)) goto fail; + if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; - if (!RADEONGetPLLParameters(pScrn)) goto fail; + if (!RADEONGetPLLParameters(pScrn)) goto fail; - if (!RADEONPreInitDDC(pScrn)) goto fail; + if (!RADEONPreInitDDC(pScrn, pInt10)) goto fail; - if (!RADEONPreInitGamma(pScrn)) goto fail; + if (!RADEONPreInitGamma(pScrn)) goto fail; - if (!RADEONPreInitModes(pScrn)) goto fail; + if (!RADEONPreInitModes(pScrn)) goto fail; - if (!RADEONPreInitCursor(pScrn)) goto fail; + if (!RADEONPreInitCursor(pScrn)) goto fail; - if (!RADEONPreInitAccel(pScrn)) goto fail; + if (!RADEONPreInitAccel(pScrn)) goto fail; #ifdef XF86DRI - if (!RADEONPreInitDRI(pScrn)) goto fail; + if (!RADEONPreInitDRI(pScrn)) goto fail; #endif /* Free the video bios (if applicable) */ @@ -1341,6 +1342,10 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + return TRUE; fail: @@ -1352,6 +1357,10 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + vgaHWFreeHWRec(pScrn); RADEONFreeRec(pScrn); return FALSE; @@ -1520,9 +1529,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #else switch (pScrn->bitsPerPixel) { case 8: @@ -1832,14 +1839,10 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) )) return FALSE; /* DPMS setup */ -#ifdef DPMSExtension #ifdef ENABLE_FLAT_PANEL if (!info->HasPanelRegs || info->CRTOnly) - xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); -#else - xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); -#endif #endif + xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); RADEONInitVideo(pScreen); @@ -2965,7 +2968,6 @@ void RADEONFreeScreen(int scrnIndex, int flags) RADEONFreeRec(pScrn); } -#ifdef DPMSExtension /* Sets VESA Display Power Management Signaling (DPMS) Mode. */ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2997,4 +2999,3 @@ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, break; } } -#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c index 25b639d33..9ccf8a6c2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.2 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.3 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c index e37dbe066..1c0549d5e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.5 2000/12/13 02:45:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.6 2001/01/06 20:19:11 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -73,6 +73,8 @@ RADEONAvailableOptions(int chipid, int busid) * Return options defined in the radeon submodule which will have been * loaded by this point. */ + if ((chipid >> 16) == PCI_VENDOR_ATI) + chipid -= PCI_VENDOR_ATI << 16; for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) { if (chipid == RADEONPciChipsets[i].PCIid) return RADEONOptions; @@ -146,7 +148,7 @@ RADEONProbe(DriverPtr drv, int flags) pEnt = xf86GetEntityInfo(usedChips[i]); if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER if (!xf86LoadSubModule(pScrn, "radeon")) { @@ -158,6 +160,7 @@ RADEONProbe(DriverPtr drv, int flags) xf86LoaderReqSymLists(RADEONSymbols, NULL); +#ifndef ELFDEBUG /* Workaround for possible loader bug */ # define RADEONPreInit \ (xf86PreInitProc*) LoaderSymbol("RADEONPreInit") @@ -175,6 +178,7 @@ RADEONProbe(DriverPtr drv, int flags) (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen") # define RADEONValidMode \ (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode") +#endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h index 20ad35cbc..6f59b40ee 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.4 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.6 2001/01/11 03:36:58 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -56,6 +56,11 @@ #include "xf86_ansic.h" #include "compiler.h" +/* Atomic updates of PLL clock don't seem to always work and stick, thus + * the bit never resets. Here - we use our own check by reading back the + * register we've just wrote to make sure it's got the Right! value */ +#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */ + /* Memory mapped register access macros */ #define INREG8(addr) MMIO_IN8(RADEONMMIO, addr) #define INREG16(addr) MMIO_IN16(RADEONMMIO, addr) @@ -139,7 +144,7 @@ RADEON_DAC_PALETTE_ACC_CTL); \ } else { \ OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) & \ - ~RADEON_DAC_PALETTE_ACC_CTL); \ + (CARD32)~RADEON_DAC_PALETTE_ACC_CTL); \ } \ } while (0) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c index 873726ede..f18762c72 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.8 2000/12/13 12:58:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.10 2001/01/25 02:27:50 mvojkovi Exp $ */ #include "radeon.h" #include "radeon_reg.h" @@ -460,6 +460,11 @@ RADEONQueryBestSize( unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 4)) + drw_w = vid_w >> 4; + if(vid_h > (drw_h << 4)) + drw_h = vid_h >> 4; + *p_w = drw_w; *p_h = drw_h; } @@ -776,7 +781,8 @@ RADEONPutImage( if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, + (CARD32)~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp b/xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp deleted file mode 100644 index 281ea82f6..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp +++ /dev/null @@ -1,203 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp,v 1.9 2000/12/12 18:54:30 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CHIPS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -chips \- Chips and Technologies video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qchips\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B chips -is an XFree86 driver for Chips and Technologies video processors. The majority -of the Chips and Technologies chipsets are supported by this driver. In general -the limitation on the capabilities of this driver are determined by the -chipset on which it is run. Where possible, this driver provides full -acceleration and supports the following depths: 1, 4, 8, 15, 16, 24 and on -the latest chipsets an 8+16 overlay mode. All visual types are supported for -depth 1, 4 and 8 and both TrueColor and DirectColor visuals are supported -where possible. Multi-head configurations are supported on PCI or AGP buses. -.SH SUPPORTED HARDWARE -The -.B chips -driver supports video processors on most of the bus types currently available. -The chipsets supported fall into one of three architectural classes. A -.B basic -architecture, the -.B WinGine -architecture and the newer -.B HiQV -architecture. -.PP -.B Basic Architecture -.PP -The supported chipsets are -.B ct65520, ct65525, ct65530, ct65535, ct65540, ct65545, ct65546 -and -.B ct65548 -.PP -Color depths 1, 4 and 8 are supported on all chipsets, while depths 15, 16 -and 24 are supported only on the -.B 65540, 65545, 65546 -and -.B 65548 -chipsets. The driver is accelerated when used with the -.B 65545, 65546 -or -.B 65548 -chipsets, however the DirectColor visual is not available. -.PP -.B Wingine Architecture -.PP -The supported chipsets are -.B ct64200 -and -.B ct64300 -.PP -Color depths 1, 4 and 8 are supported on both chipsets, while depths 15, 16 -and 24 are supported only on the -.B 64300 -chipsets. The driver is accelerated when used with the -.B 64300 -chipsets, however the DirectColor visual is not available. -.PP -.B HiQV Architecture -.PP -The supported chipsets are -.B ct65550, ct65554, ct65555, ct68554, ct69000 -and -.B ct69030 -.PP -Color depths 1, 4, 8, 15, 16, 24 and 8+16 are supported on all chipsets. -The DirectColor visual is supported on all color depths except the 8+16 -overlay mode. Full acceleration is supplied for all chipsets. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"ct65520", "ct65525", "ct65530", "ct65535", "ct65540", "ct65545", "ct65546", -"ct65548", "ct65550", "ct65554", "ct65555", "ct68554", "ct69000", "ct69030", -"ct64200", "ct64300". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chipsets. But maybe overridden with the -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -The following driver -.B Options -are supported, on one or more of the supported chipsets: -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qNoLinear\*q \*q" boolean \*q -Disables linear addressing in cases where it is enabled by default. -Default: off -.TP -.BI "Option \*qLinear\*q \*q" boolean \*q -Enables linear addressing in cases where it is disabled by default. -Default: off -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: off. -.TP -.BI "Option \*qSTN\*q \*q" boolean \*q -Force detection of STN screen type. Default: off. -.TP -.BI "Option \*qUseModeline\*q \*q" boolean \*q -Reprogram flat panel timings with values from the modeline. Default: off -.TP -.BI "Option \*qFixPanelSize\*q \*q" boolean \*q -Reprogram flat panel size with values from the modeline. Default: off -.TP -.BI "Option \*qNoStretch\*q \*q" boolean \*q -This option disables the stretching on a mode on a flat panel to fill the -screen. Default: off -.TP -.BI "Option \*qLcdCenter\*q \*q" boolean \*q -Center the mode displayed on the flat panel on the screen. Default: off -.TP -.BI "Option \*qHWclocks\*q \*q" boolean \*q -Force the use of fixed hardware clocks on chips that support both fixed -and programmable clocks. Default: off -.TP -.BI "Option \*qUseVclk1\*q \*q" boolean \*q -Use the Vclk1 programable clock on -.B HiQV -chipsets instead of Vclk2. Default: off -.TP -.BI "Option \*qFPClock8\*q \*q" float \*q -.TP -.BI "Option \*qFPClock16\*q \*q" float \*q -.TP -.BI "Option \*qFPClock24\*q \*q" float \*q -.TP -.BI "Option \*qFPClock32\*q \*q" float \*q -Force the use of a particular video clock speed for use with the -flat panel at a specified depth -.TP -.BI "Option \*qMMIO\*q \*q" boolean \*q -Force the use of memory mapped IO where it can be used. Default: off -.TP -.BI "Option \*qSuspendHack\*q \*q" boolean \*q -Force driver to leave centering and stretching registers alone. This -can fix some laptop suspend/resume problems. Default: off -.TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off. -.TP -.BI "Option \*qColorKey\*q \*q" integer \*q -Set the colormap index used for the transparency key for the depth 8 plane -when operating in 8+16 overlay mode. The value must be in the range -2\-255. Default: 255. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -Default: undefined. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option \*qShowCache\*q \*q" boolean \*q -Enable or disable viewing offscreen memory. Used for debugging only -Default: off. -.TP -.BI "Option \*q18bitBus\*q \*q" boolean \*q -Force the driver to assume that the flat panel has an 18bit data bus. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.PP -You are also recommended to read the README.chips file that comes with all -XFree86 distributions, which discusses the -.B chips -driver in more detail. -.SH AUTHORS -Authors include: Jon Block, Mike Hollick, Regis Cridlig, Nozomi Ytow, -Egbert Eich, David Bateman and Xavier Ducoin - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c index fc0fbffb3..864b7843b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.5 2000/09/22 11:35:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.6 2001/02/15 18:36:11 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -58,8 +58,9 @@ void CHIPSInitVideo(ScreenPtr pScreen) CHIPSPtr cPtr = CHIPSPTR(pScrn); int num_adaptors; - if(!(cPtr->Flags & ChipsOverlay8plus16) && - (cPtr->Flags & ChipsVideoSupport)) { + if (!(cPtr->Flags & ChipsOverlay8plus16) && + (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsAccelSupport)) { newAdaptor = CHIPSSetupImageVideo(pScreen); CHIPSInitOffscreenImages(pScreen); } @@ -390,12 +391,10 @@ CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) CHIPSPtr cPtr = CHIPSPTR(pScrn); unsigned char mr3c, tmp; - ErrorF("StopVideo\n"); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); CHIPSHiQVSync(pScrn); if(exit) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - ErrorF("StopVideo Exit\n"); mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); tmp = cPtr->readXR(cPtr, 0xD0); @@ -610,7 +609,6 @@ CHIPSDisplayVideo( CHIPSHiQVSync(pScrn); - ErrorF("DisplayVideo\n"); tmp = cPtr->readXR(cPtr, 0xD0); cPtr->writeXR(cPtr, 0xD0, (tmp | 0x10)); @@ -629,7 +627,8 @@ CHIPSDisplayVideo( tmp |= 0x08; break; case FOURCC_YV12: /* YV12 */ - tmp |= 0x03; + /* tmp |= 0x03 */ + tmp |= 0x00; break; case FOURCC_YUY2: /* YUY2 */ default: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h index ca26b8fe9..4373eabba 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.4 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.6 2001/02/15 17:39:28 eich Exp $ */ /* (c) Itai Nahshon */ @@ -35,6 +35,8 @@ enum { CIR_NSAVED }; +typedef enum {LCD_NONE, LCD_DUAL_MONO, LCD_UNKNOWN, LCD_DSTN, LCD_TFT} LCDType; + typedef struct { unsigned char ExtVga[CIR_NSAVED]; } AlpRegRec, *AlpRegPtr; @@ -54,6 +56,8 @@ typedef struct alpRec { AlpRegRec SavedReg; AlpRegRec ModeReg; + LCDType lcdType; + int lcdWidth, lcdHeight; int CursorWidth; int CursorHeight; int waitMsk; @@ -69,6 +73,10 @@ typedef struct alpRec { CARD32 monoPattern8x8; Bool autoStart; + + /* MMIO Base for BitBLT operation. This is + IOBase for 5446 and 7548, IOBase+0x100 for 5480 */ + unsigned char * BLTBase; /* XXX For XF86Config based mem configuration */ CARD32 sr0f, sr17; } AlpRec, *AlpPtr; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c deleted file mode 100644 index 544a3aa77..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */ - -/* (c) Itai Nahshon */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "compiler.h" - -#include "xf86Pci.h" -#include "xf86PciInfo.h" - -#include "vgaHW.h" - -#include "cir.h" - -static Bool -CirDGAGetParams(int scrnIndex, unsigned long *offset, int *banksize, - int *memsize) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - CIRPtr pCir = &CIRPTR(pScrn)->CirRec; - - *offset = pCir->FbAddress; - *banksize = pScrn->videoRam * 1024; - *memsize = pScrn->videoRam * 1024; - -#ifdef CIR_DEBUG - ErrorF("CirDGAGetParams %d = 0x%08x, %d, %d\n", - scrnIndex, *banksize, *memsize); -#endif - return TRUE; -} - -static Bool -CirDGASetDirect(int scrnIndex, Bool enable) -{ - return TRUE; -} - -static Bool -CirDGASetBank(int scrnIndex, int bank, int flags) -{ - return TRUE; -} - -static Bool -CirDGASetViewport(int scrnIndex, int x, int y, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - (*pScrn->AdjustFrame)(scrnIndex, x, y, 0); - return TRUE; -} - -static Bool -CirDGAViewportChanged(int scrnIndex, int n, int flags) -{ - return TRUE; -} - -Bool -CirDGAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - CIRPtr pCir = &CIRPTR(pScrn)->CirRec; - DGAInfoPtr pDGAInfo; - - pDGAInfo = DGACreateInfoRec(); - if(pDGAInfo == NULL) - return FALSE; - - pCir->DGAInfo = pDGAInfo; - - pDGAInfo->GetParams = CirDGAGetParams; - pDGAInfo->SetDirectMode = CirDGASetDirect; - pDGAInfo->SetBank = CirDGASetBank; - pDGAInfo->SetViewport = CirDGASetViewport; - pDGAInfo->ViewportChanged = CirDGAViewportChanged;; - - return DGAInit(pScreen, pDGAInfo, 0); -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c index 1eec31b39..9d68f0767 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.17 2000/12/07 15:43:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.19 2001/02/15 17:39:27 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -57,13 +57,6 @@ #include "xf1bpp.h" #include "fb.h" -/* These need to be checked */ -#if 0 -#ifdef XFreeXDGA -#define _XF86DGA_SERVER_ -#include "extensions/xf86dgastr.h" -#endif -#endif #include "xf86DDC.h" #include "xf86int10.h" @@ -112,10 +105,10 @@ static void AlpProbeLCD(ScrnInfoPtr pScrn); static void AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq); -#ifdef DPMSExtension +static void AlpOffscreenAccelInit(ScrnInfoPtr pScrn); + static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* * This is intentionally screen-independent. It indicates the binding @@ -176,13 +169,18 @@ static const char *vgahwSymbols[] = { NULL }; +#ifdef XFree86LOADER + static const char *fbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", "fbScreenInit", + "fbPictureInit", NULL }; +#endif + static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAACreateInfoRec", @@ -510,10 +508,11 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) { CirPtr pCir; vgaHWPtr hwp; - MessageType from; + MessageType from, from1; int i; ClockRangePtr clockRanges; char *s; + xf86Int10InfoPtr pInt = NULL; if (flags & PROBE_DETECT) { cirProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); @@ -560,11 +559,8 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) pCir->PciInfo->device, pCir->PciInfo->func); -#if 1 if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86LoaderReqSymLists(int10Symbols,NULL); -#if 1 xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); pInt = xf86InitInt10(pCir->pEnt->index); xf86FreeInt10(pInt); @@ -575,9 +571,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) pciWriteLong(pCir->PciTag,0x10,pCir->PciInfo->memBase[0]); pciWriteLong(pCir->PciTag,0x14,pCir->PciInfo->memBase[1]); -#endif } -#endif /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -639,6 +633,11 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, CirOptions); + if (!xf86IsPrimaryPci(pCir->PciInfo) + && !(pInt || (xf86IsOptionSet(CirOptions,OPTION_MEMCFG1) + && xf86IsOptionSet(CirOptions,OPTION_MEMCFG2)))) + return FALSE; + if (pScrn->depth == 8) pScrn->rgbBits = 6; @@ -718,14 +717,6 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) /* We do not really need that YET. */ } } - if(pCir->IOAddress != 0) { - xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", - (unsigned long)pCir->IOAddress); - /* Default to MMIO if we have a separate IOAddress and - not in monochrome mode (IO 0x3Bx is not relocated!) */ - if (pScrn->bitsPerPixel != 1) - pCir->UseMMIO = TRUE; - } /* User options can override the MMIO default */ #if 0 @@ -737,10 +728,28 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) #endif if (!xf86ReturnOptValBool(CirOptions, OPTION_MMIO, TRUE)) { pCir->UseMMIO = FALSE; - from = X_CONFIG; - } - if (pCir->UseMMIO) - xf86DrvMsg(pScrn->scrnIndex, from, "Using MMIO\n"); + from1 = X_CONFIG; + } else if (pCir->IOAddress) { + /* Default to MMIO if we have a separate IOAddress and + not in monochrome mode (IO 0x3Bx is not relocated!) */ + if (pScrn->bitsPerPixel != 1) { + pCir->UseMMIO = TRUE; + from1 = X_PROBED; + } else { + pCir->UseMMIO = FALSE; + from1 = X_PROBED; + } + } else { + pCir->UseMMIO = FALSE; + from1 = X_PROBED; + } + + if (pCir->UseMMIO) { + xf86DrvMsg(pScrn->scrnIndex, from1, "Using MMIO\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", + (unsigned long)pCir->IOAddress); + } else + xf86DrvMsg(pScrn->scrnIndex, from1, "Not Using MMIO\n"); /* * XXX Check if this is correct @@ -1078,10 +1087,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) AlpFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit",NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); break; } @@ -1458,6 +1464,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VisualPtr visual; int displayWidth,width,height; unsigned char * FbBase = NULL; + int cursor_size = 0; #ifdef ALP_DEBUG ErrorF("AlpScreenInit\n"); @@ -1582,9 +1589,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (!ret) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #ifdef ALP_DEBUG ErrorF("AlpScreenInit after depth dependent init\n"); @@ -1612,83 +1617,64 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) */ xf86SetBlackWhitePixels(pScreen); - xf86SetSilkenMouse(pScreen); - - /* Initialise cursor functions */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - - /* Allocation of off-screen memory to various stuff + /* + Allocation of off-screen memory to various stuff (hardware cursor, 8x8 mono pattern...) Allocation goes top-down in memory, since the cursor - *must* be in the last videoram locations */ - { - int offscreen_offset = pScrn->videoRam*1024, - offscreen_size = pScrn->videoRam * 1024 - pScrn->virtualY * - (BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel)); - int cursor_size = 0; + *must* be in the last videoram locations + */ + pCir->offscreen_offset = pScrn->videoRam*1024; + pCir->offscreen_size = pScrn->videoRam * 1024 - pScrn->virtualY * + (BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel)); #ifdef ALP_DEBUG - ErrorF("offscreen_offset=%d, offscreen_size=%d\n", - offscreen_offset, offscreen_size); + ErrorF("offscreen_offset=%d, offscreen_size=%d\n", + pCir->offscreen_offset, pCir->offscreen_size); #endif /* Initialise cursor functions */ - if (pCir->HWCursor) { /* Initialize HW cursor layer */ - if ((pCir->properties & HWCUR64) - && (offscreen_size >= 64*8*2)) - { - cursor_size = 64; - offscreen_size -= 64*8*2; - offscreen_offset -= 64*8*2; - } - else if (offscreen_size >= 32*4*2) - { - cursor_size = 32; - offscreen_size -= 32*8*2; - offscreen_offset -= 32*8*2; - } - if (!AlpHWCursorInit(pScreen, cursor_size)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Hardware cursor initialization failed\n"); + if (pCir->HWCursor) { /* Initialize HW cursor layer */ + + if ((pCir->properties & HWCUR64) + && (pCir->offscreen_size >= 64*8*2)) { + cursor_size = 64; + pCir->offscreen_size -= 64*8*2; + pCir->offscreen_offset -= 64*8*2; + } else if (pCir->offscreen_size >= 32*4*2) { + cursor_size = 32; + pCir->offscreen_size -= 32*8*2; + pCir->offscreen_offset -= 32*8*2; } -#ifdef ALP_DEBUG - ErrorF("AlpHWCursorInit complete.\n"); -#endif - if (offscreen_size >= 8 && !pCir->NoAccel && - pCir->Chipset == PCI_CHIP_GD7548) - { - offscreen_offset -= 8; - offscreen_size -= 8; - pAlp->monoPattern8x8 = offscreen_offset; -#ifdef ALP_DEBUG - ErrorF("monoPattern8x8=%d\n", pAlp->monoPattern8x8); -#endif - } - else pAlp->monoPattern8x8 = 0; - { - /* TODO: probably not correct if rotated */ - BoxRec box; - box.x1=0; - box.y1=0; - box.x2=pScrn->virtualX; - box.y2=offscreen_offset / pCir->pitch; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d lines for offscreen memory\n", - box.y2 - pScrn->virtualY); - } - } if (!pCir->NoAccel) { /* Initialize XAA functions */ - if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) : - AlpXAAInit(pScreen))) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not initialize XAA\n"); + AlpOffscreenAccelInit(pScrn); + if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) : + AlpXAAInit(pScreen))) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not initialize XAA\n"); } -#if 0 - if (!AlpDGAInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DGA initialization failed\n"); +#if 1 + pCir->DGAModeInit = AlpModeInit; + if (!CirDGAInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "DGA initialization failed\n"); #endif + xf86SetSilkenMouse(pScreen); + + /* Initialise cursor functions */ + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + if (pCir->HWCursor) { + if (!AlpHWCursorInit(pScreen, cursor_size)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); +#ifdef ALP_DEBUG + ErrorF("AlpHWCursorInit() complete\n"); +#endif + } + if (pCir->shadowFB) { RefreshAreaFuncPtr refreshArea = cirRefreshArea; @@ -1716,9 +1702,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (pScrn->bitsPerPixel > 1 && pScrn->bitsPerPixel <= 8) vgaHWHandleColormaps(pScreen); -#ifdef DPMSExtension xf86DPMSInit(pScreen, AlpDisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = pCir->FbAddress; pScrn->fbOffset = 0; @@ -1811,12 +1795,20 @@ Bool AlpEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + CirPtr pCir = CIRPTR(pScrn); + Bool ret; + #ifdef ALP_DEBUG ErrorF("AlpEnterVT\n"); #endif /* Should we re-save the text mode on each VT enter? */ - return AlpModeInit(pScrn, pScrn->currentMode); + if (!(ret = AlpModeInit(pScrn, pScrn->currentMode))) + return FALSE; + + pCir->InitAccel(pScrn); + + return ret; } @@ -1869,11 +1861,10 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pCir->CursorInfoRec) xf86DestroyCursorInfoRec(pCir->CursorInfoRec); pCir->CursorInfoRec = NULL; -#if 0 - if (pCir->DGAInfo) - DGADestroyInfoRec(pCir->DGAInfo); - pCir->DGAInfo = NULL; -#endif + if (pCir->DGAModes) + xfree(pCir->DGAModes); + pCir->DGAnumModes = 0; + pCir->DGAModes = NULL; pScrn->vtSema = FALSE; @@ -1983,7 +1974,6 @@ AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq) * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2031,7 +2021,6 @@ AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, gr0e |= hwp->readGr(hwp, 0x0E) & ~0x06; hwp->writeGr(hwp, 0x0E, gr0e); } -#endif #ifdef ALPPROBEI2C static void AlpProbeI2C(int scrnIndex) @@ -2061,69 +2050,96 @@ static void AlpProbeI2C(int scrnIndex) static void AlpProbeLCD(ScrnInfoPtr pScrn) { - CirPtr pCir = CIRPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - static const char* lcd_type_names[] = - { - "none", - "dual-scan monochrome", - "unknown", - "DSTN (dual scan color)", - "TFT (active matrix)" - }; + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD8 lcdCrtl; - pCir -> lcdType = LCD_NONE; + static const char* lcd_type_names[] = + { + "none", + "dual-scan monochrome", + "unknown", + "DSTN (dual scan color)", + "TFT (active matrix)" + }; - switch (pCir -> Chipset) - { - case PCI_CHIP_GD7548: - switch (hwp->readCrtc(hwp, 0x2C) >> 6) - { - case 0: pCir->lcdType = LCD_DUAL_MONO; break; - case 1: pCir->lcdType = LCD_UNKNOWN; break; - case 2: pCir->lcdType = LCD_DSTN; break; - case 3: pCir->lcdType = LCD_TFT; break; - } - - /* Enable LCD control registers instead of normal CRTC registers */ - hwp->writeCrtc(hwp, 0x2D, hwp->readCrtc(hwp, 0x2D) | 0x80); - - switch ((hwp->readCrtc(hwp, 0x9) >> 2) & 3) - { + + pAlp->lcdType = LCD_NONE; + + switch (pCir->Chipset) { + case PCI_CHIP_GD7548: + switch (hwp->readCrtc(hwp, 0x2C) >> 6) { + case 0: pAlp->lcdType = LCD_DUAL_MONO; break; + case 1: pAlp->lcdType = LCD_UNKNOWN; break; + case 2: pAlp->lcdType = LCD_DSTN; break; + case 3: pAlp->lcdType = LCD_TFT; break; + } + + /* Enable LCD control registers instead of normal CRTC registers */ + lcdCrtl = hwp->readCrtc(hwp, 0x2D); + hwp->writeCrtc(hwp, 0x2D, lcdCrtl | 0x80); + + switch ((hwp->readCrtc(hwp, 0x9) >> 2) & 3) { case 0: - pCir->lcdWidth = 640; - pCir->lcdHeight = 480; - break; + pAlp->lcdWidth = 640; + pAlp->lcdHeight = 480; + break; - case 1: - pCir->lcdWidth = 800; - pCir->lcdHeight = 600; - break; + case 1: + pAlp->lcdWidth = 800; + pAlp->lcdHeight = 600; + break; case 2: - pCir->lcdWidth = 1024; - pCir->lcdHeight = 768; - break; + pAlp->lcdWidth = 1024; + pAlp->lcdHeight = 768; + break; case 3: - pCir->lcdWidth = 0; - pCir->lcdHeight = 0; - break; - } + pAlp->lcdWidth = 0; + pAlp->lcdHeight = 0; + break; + } - /* Disable LCD control registers */ - hwp->writeCrtc(hwp, 0x2D, hwp->readCrtc(hwp, 0x2D) & ~0x80); - break; - } + /* Disable LCD control registers */ + hwp->writeCrtc(hwp, 0x2D, lcdCrtl); + break; + } - if (pCir -> lcdType != LCD_NONE) - { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "LCD display: %dx%d %s\n", - pCir->lcdWidth, pCir->lcdHeight, - lcd_type_names[pCir->lcdType]); - } + if (pAlp->lcdType != LCD_NONE) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "LCD display: %dx%d %s\n", + pAlp->lcdWidth, pAlp->lcdHeight, + lcd_type_names[pAlp->lcdType]); + } } +static void +AlpOffscreenAccelInit(ScrnInfoPtr pScrn) +{ + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + if (pCir->offscreen_size >= 8 && pCir->Chipset == PCI_CHIP_GD7548) { + pCir->offscreen_offset -= 8; + pCir->offscreen_size -= 8; + pAlp->monoPattern8x8 = pCir->offscreen_offset; +#ifdef ALP_DEBUG + ErrorF("monoPattern8x8=%d\n", pAlp->monoPattern8x8); +#endif + } else pAlp->monoPattern8x8 = 0; + + { + /* TODO: probably not correct if rotated */ + BoxRec box; + box.x1=0; + box.y1=0; + box.x2=pScrn->virtualX; + box.y2= pCir->offscreen_offset / pCir->pitch; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d lines for offscreen memory\n", + box.y2 - pScrn->virtualY); + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c index 77b8920f4..5872a905a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.5 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.6 2001/02/15 17:39:27 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -565,120 +565,120 @@ AlpSubsequentColorExpandScanline( } #endif +static void +AlpAccelEngineInit(ScrnInfoPtr pScrn) +{ + CirPtr pCir = CIRPTR(pScrn); + + outw(0x3CE, 0x200E); /* enable writes to gr33 */ + /* Setup things for autostart */ + if (pCir->properties & ACCEL_AUTOSTART) { + outw(0x3CE, 0x8031); /* enable autostart */ + pCir->chip.alp->waitMsk = 0x10; + pCir->chip.alp->autoStart = TRUE; + } else { + pCir->chip.alp->waitMsk = 0x1; + pCir->chip.alp->autoStart = FALSE; + } +} + Bool AlpXAAInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - XAAInfoRecPtr XAAPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + XAAInfoRecPtr XAAPtr; + pCir->InitAccel = AlpAccelEngineInit; #ifdef ALP_DEBUG - ErrorF("AlpXAAInit\n"); + ErrorF("AlpXAAInit\n"); #endif - XAAPtr = XAACreateInfoRec(); - if (!XAAPtr) return FALSE; - - XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; - XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = - NO_TRANSPARENCY | NO_PLANEMASK; - - switch (pCir->Chipset) - { - case PCI_CHIP_GD7548: - if (!pAlp->monoPattern8x8) break; - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_PLANEMASK; - - XAAPtr->SetupForMono8x8PatternFill = AlpSetupForMono8x8PatternFill; - XAAPtr->SubsequentMono8x8PatternFillRect = - AlpSubsequentMono8x8PatternFillRect; - XAAPtr->SubsequentMono8x8PatternFillTrap = NULL; - XAAPtr->Mono8x8PatternFillFlags = - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; - -#if 0 - /* Currently disabled: XF86 sends DWORD-padded data, - not byte-padded */ - XAAPtr->SetupForCPUToScreenColorExpandFill = - AlpSetupForCPUToScreenColorExpandFill; - XAAPtr->SubsequentCPUToScreenColorExpandFill = - AlpSubsequentCPUToScreenColorExpandFill; - XAAPtr->ColorExpandBase = pCir->FbBase + 4; - XAAPtr->CPUToScreenColorExpandFillFlags = - NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE | - CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED; -#endif + XAAPtr = XAACreateInfoRec(); + if (!XAAPtr) return FALSE; + + /* Pixmap cache */ + XAAPtr->Flags |= LINEAR_FRAMEBUFFER; + XAAPtr->Sync = AlpSync; + + XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; + XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; + XAAPtr->ScreenToScreenCopyFlags = + NO_TRANSPARENCY | NO_PLANEMASK; + + XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; + XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; + XAAPtr->SubsequentSolidFillTrap = NULL; + XAAPtr->SolidFillFlags = NO_PLANEMASK; + + if (pCir->Chipset == PCI_CHIP_GD7548) { + if (pAlp->monoPattern8x8) { + XAAPtr->SetupForMono8x8PatternFill + = AlpSetupForMono8x8PatternFill; + XAAPtr->SubsequentMono8x8PatternFillRect + = AlpSubsequentMono8x8PatternFillRect; + XAAPtr->SubsequentMono8x8PatternFillTrap = NULL; + XAAPtr->Mono8x8PatternFillFlags = + NO_PLANEMASK | + HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; + } #if 1 - /* kludge: since XF86 does not support byte-padded - mono bitmaps (only dword-padded), use the - scanline version */ - XAAPtr->SetupForScanlineCPUToScreenColorExpandFill = + /* kludge: since XF86 does not support byte-padded + mono bitmaps (only dword-padded), use the + scanline version */ + XAAPtr->SetupForScanlineCPUToScreenColorExpandFill = AlpSetupForScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentScanlineCPUToScreenColorExpandFill = + XAAPtr->SubsequentScanlineCPUToScreenColorExpandFill = AlpSubsequentScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentColorExpandScanline = + XAAPtr->SubsequentColorExpandScanline = AlpSubsequentColorExpandScanline; - { - const int NumScanlineColorExpandBuffers = 2; - int i; - int buffer_size = (pCir->pScrn->virtualX + 31) & ~31; + { + const int NumScanlineColorExpandBuffers = 2; + int i; + int buffer_size = (pCir->pScrn->virtualX + 31) & ~31; #ifdef ALP_DEBUG - ErrorF("Computing buffers for %d pixel lines\n", - pCir->pScrn->virtualX); + ErrorF("Computing buffers for %d pixel lines\n", + pCir->pScrn->virtualX); #endif - XAAPtr->NumScanlineColorExpandBuffers = + XAAPtr->NumScanlineColorExpandBuffers = NumScanlineColorExpandBuffers; - XAAPtr->ScanlineColorExpandBuffers = + XAAPtr->ScanlineColorExpandBuffers = pCir->ScanlineColorExpandBuffers = (unsigned char **) (malloc(sizeof(unsigned char *) * NumScanlineColorExpandBuffers)); /* TODO: are those mallocs to be freed ? */ - for(i=0; i<NumScanlineColorExpandBuffers; i++) + for(i=0; i<NumScanlineColorExpandBuffers; i++) pCir->ScanlineColorExpandBuffers[i] = (unsigned char *) malloc(buffer_size); - } - XAAPtr->ScanlineCPUToScreenColorExpandFillFlags = + } + XAAPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE; #endif - break; - - case PCI_CHIP_GD5446: - case PCI_CHIP_GD5480: - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_TRANSPARENCY|NO_PLANEMASK; - outw(0x3CE, 0x200E); /* enable writes to gr33 */ - break; - } - - /* TODO: probably too limited */ +#if 0 + /* Currently disabled: XF86 sends DWORD-padded data, + not byte-padded */ + XAAPtr->SetupForCPUToScreenColorExpandFill = + AlpSetupForCPUToScreenColorExpandFill; + XAAPtr->SubsequentCPUToScreenColorExpandFill = + AlpSubsequentCPUToScreenColorExpandFill; + XAAPtr->ColorExpandBase = pCir->FbBase + 4; + XAAPtr->CPUToScreenColorExpandFillFlags = + NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | + SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE | + CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED; +#endif + } - XAAPtr->Sync = AlpSync; + AlpAccelEngineInit(pScrn); - /* Pixmap cache */ - XAAPtr -> Flags |= LINEAR_FRAMEBUFFER; + pCir->AccelInfoRec = XAAPtr; - /* Setup things for autostart */ - if (pCir->properties & ACCEL_AUTOSTART) { - outw(0x3CE, 0x8031); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; - } - if (!XAAInit(pScreen, XAAPtr)) - return FALSE; + if (!XAAInit(pScreen, XAAPtr)) + return FALSE; - return TRUE; + return TRUE; } + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c index 105c9d444..e77926899 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.4 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.6 2001/02/15 17:39:27 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -19,25 +19,55 @@ #ifdef DEBUG #define minb(p) \ ErrorF("minb(%X)\n", p),\ - MMIO_IN8(pCir->IOBase, (p)) + MMIO_IN8(pCir->chip.alp->BLTBase, (p)) #define moutb(p,v) \ ErrorF("moutb(%X)\n", p),\ - MMIO_OUT8(pCir->IOBase, (p),(v)) + MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) +#define vga_minb(p) \ + ErrorF("minb(%X)\n", p),\ + MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p))) +#define vga_moutb(p,v) \ + ErrorF("moutb(%X)\n", p),\ + MMIO_OUT8(pCir->MMIOBase, (hwp->MMIOOffset + (p)),(v)) #define minl(p) \ ErrorF("minl(%X)\n", p),\ - MMIO_IN32(pCir->IOBase, (p)) + MMIO_IN32(pCir->chip.alp->BLTBase, (p)) #define moutl(p,v) \ ErrorF("moutl(%X)\n", p),\ - MMIO_OUT32(pCir->IOBase, (p),(v)) + MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) #else -#define minb(p) MMIO_IN8(pCir->IOBase, (p)) -#define moutb(p,v) MMIO_OUT8(pCir->IOBase, (p),(v)) -#define minl(p) MMIO_IN32(pCir->IOBase, (p)) -#define moutl(p,v) MMIO_OUT32(pCir->IOBase, (p),(v)) +#define minb(p) MMIO_IN8(pCir->chip.alp->BLTBase, (p)) +#define moutb(p,v) MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) +#define vga_minb(p) MMIO_IN8(hwp->MMIIOBase, (hwp->MMIOOffset + (p))) +#define vga_moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v)) +#define minl(p) MMIO_IN32(pCir->chip.alp->BLTBase, (p)) +#define moutl(p,v) MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) #endif -#define WAIT while(minb(0x40) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 while(minb(0x40) & 0x1){}; +static const CARD8 translated_rop[] = +{ + /* GXclear */ 0x00U, + /* GXand */ 0x05U, + /* GXandreverse */ 0x09U, + /* GXcopy */ 0x0DU, + /* GXandinversted */ 0x50U, + /* GXnoop */ 0x06U, + /* GXxor */ 0x59U, + /* GXor */ 0x6DU, + /* GXnor */ 0x90U, + /* GXequiv */ 0x95U, + /* GXinvert */ 0x0BU, + /* GXorReverse */ 0xADU, + /* GXcopyInverted */ 0xD0U, + /* GXorInverted */ 0xD6U, + /* GXnand */ 0xDAU, + /* GXset */ 0x0EU +}; + +#define WAIT while(minl(0x40) & pCir->chip.alp->waitMsk){}; +#define WAIT_1 while(minl(0x40) & 0x1){}; + +#define SetupForRop(rop) moutb(0x1A, translated_rop[rop]) static void AlpSync(ScrnInfoPtr pScrn) { @@ -58,6 +88,8 @@ AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, WAIT; + SetupForRop(rop); + #ifdef ALP_DEBUG ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n", xdir, ydir, rop, planemask, trans_color); @@ -70,43 +102,45 @@ static void AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h) { - CirPtr pCir = CIRPTR(pScrn); - int source, dest; - int hh, ww; - int decrement = 0; - int pitch = pCir->pitch; - - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x1fff; - dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; - source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; - if (dest > source) { - decrement = 1; - dest += hh * pitch + ww; - source += hh * pitch + ww; - } - - WAIT; - - /* Width / Height */ - moutl(0x08, (hh << 16) | ww); - /* source */ - moutl(0x14, source & 0x3fffff); - moutl(0x18, 0x0d0000 | decrement); - - /* dest */ - write_mem_barrier(); - moutl(0x10, dest & 0x3fffff); - + CirPtr pCir = CIRPTR(pScrn); + int source, dest; + int hh, ww; + int decrement = 0; + int pitch = pCir->pitch; + + ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; + hh = (h - 1) & 0x1fff; + dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; + source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; + if (dest > source) { + decrement = 1; + dest += hh * pitch + ww; + source += hh * pitch + ww; + } + + WAIT; + + /* Width / Height */ + moutl(0x08, (hh << 16) | ww); + /* source */ + moutl(0x14, source & 0x3fffff); + moutl(0x18, 0x0d0000 | decrement); + + /* dest */ + write_mem_barrier(); + moutl(0x10, dest & 0x3fffff); + #ifdef ALP_DEBUG - ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", - x1, y1, x2, y2, w, h); - ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", - source, dest, ww, hh); + ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", + x1, y1, x2, y2, w, h); + ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", + source, dest, ww, hh); #endif - if (!pCir->chip.alp->autoStart) - moutb(0x40,0x02); - write_mem_barrier(); + if (!pCir->chip.alp->autoStart) { + CARD32 val = minl(0x40); + moutl(0x40,val | 0x02); + } + write_mem_barrier(); } @@ -114,51 +148,75 @@ static void AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; + CirPtr pCir = CIRPTR(pScrn); + int pitch = pCir->pitch; - WAIT; + WAIT; + + SetupForRop(rop); #ifdef ALP_DEBUG - ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", - color, rop, planemask); + ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", + color, rop, planemask); #endif - moutl(0x04, color & 0xffffff); + moutl(0x04, color & 0xffffff); - /* Set dest pitch */ - moutl(0x0C, pitch & 0x1fff); - moutl(0x18, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000); + /* Set dest pitch */ + moutl(0x0C, pitch & 0x1fff); + moutl(0x18, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000); } static void AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { - int dest; - int hh, ww; - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; + int dest; + int hh, ww; + CirPtr pCir = CIRPTR(pScrn); + int pitch = pCir->pitch; - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x7ff; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; + ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; + hh = (h - 1) & 0x7ff; + dest = y * pitch + x * pScrn->bitsPerPixel / 8; - WAIT; - - /* Width / Height */ - write_mem_barrier(); - moutl(0x08, (hh << 16) | ww); + WAIT; + + /* Width / Height */ + write_mem_barrier(); + moutl(0x08, (hh << 16) | ww); #ifdef ALP_DEBUG - ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", - x, y, w, h); + ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", + x, y, w, h); #endif - /* dest */ - moutl(0x10, (dest & 0x3fffff)); + /* dest */ + moutl(0x10, (dest & 0x3fffff)); + + if (!pCir->chip.alp->autoStart) { + CARD32 val = minl(0x40); + moutl(0x40, val | 0x02); + } + write_mem_barrier(); +} - if (!pCir->chip.alp->autoStart) - moutb(0x40,0x02); - write_mem_barrier(); +static void +AlpAccelEngineInit(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + CirPtr pCir = CIRPTR(pScrn); + + if (pCir->Chipset != PCI_CHIP_GD7548) { + vga_moutb(0x3CE, 0x0E); /* enable writes to gr33 */ + vga_moutb(0x3CF, 0x20); /* enable writes to gr33 */ + } + if (pCir->properties & ACCEL_AUTOSTART) { + moutl(0x40, 0x80); /* enable autostart */ + pCir->chip.alp->waitMsk = 0x10; + pCir->chip.alp->autoStart = TRUE; + } else { + pCir->chip.alp->waitMsk = 0x1; + pCir->chip.alp->autoStart = FALSE; + } } Bool @@ -167,43 +225,48 @@ AlpXAAInitMMIO(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; CirPtr pCir = CIRPTR(pScrn); XAAInfoRecPtr XAAPtr; - + + pCir->InitAccel = AlpAccelEngineInit; #ifdef ALP_DEBUG - ErrorF("AlpXAAInit mm\n"); + ErrorF("AlpXAAInitMM\n"); #endif XAAPtr = XAACreateInfoRec(); if (!XAAPtr) return FALSE; + + XAAPtr->Flags |= LINEAR_FRAMEBUFFER; + XAAPtr->Sync = AlpSync; XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK; + XAAPtr->ScreenToScreenCopyFlags = + (NO_TRANSPARENCY | NO_PLANEMASK); XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK; - - XAAPtr->Sync = AlpSync; - - if (pCir->Chipset != PCI_CHIP_GD7548) - { - moutb(0x3CE, 0x0E); /* enable writes to gr33 */ - moutb(0x3CF, 0x20); /* enable writes to gr33 */ - } - - if (pCir->properties & ACCEL_AUTOSTART) { - moutb(0x40, 0x80); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; + XAAPtr->SolidFillFlags = NO_PLANEMASK; + + switch (pCir->Chipset) { + case PCI_CHIP_GD5480: + pCir->chip.alp->BLTBase = pCir->IOBase + 0x100; + break; + default: + pCir->chip.alp->BLTBase = pCir->IOBase; + break; } + AlpAccelEngineInit(pScrn); + + pCir->AccelInfoRec = XAAPtr; + if (!XAAInit(pScreen, XAAPtr)) - return FALSE; + return FALSE; return TRUE; } + + + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c new file mode 100644 index 000000000..3e25a53d8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c @@ -0,0 +1,257 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5 2001/02/15 17:39:27 eich Exp $ */ +/* + * Copyright 2000 by Egbert Eich + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * EGBERT EICH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Adapted from: Alan Hourihane, <alanh@fairlite.demon.co.uk> + * by: Egbert Eich + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaa.h" +#include "xaalocal.h" +#include "vgaHW.h" +#include "cir.h" +#include "dgaproc.h" + +static Bool Cir_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static Bool Cir_SetMode(ScrnInfoPtr, DGAModePtr); +static void Cir_Sync(ScrnInfoPtr); +static int Cir_GetViewport(ScrnInfoPtr); +static void Cir_SetViewport(ScrnInfoPtr, int, int, int); +static void Cir_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); +static void Cir_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +/* +static void Cir_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, + unsigned long); +*/ + +static +DGAFunctionRec CirDGAFuncs = { + Cir_OpenFramebuffer, + NULL, /* Cir_CloseFramebuffer */ + Cir_SetMode, + Cir_SetViewport, + Cir_GetViewport, + Cir_Sync, + Cir_FillRect, + Cir_BlitRect, + NULL /* Cir_BlitTransRect */ +}; + + + + +Bool +CirDGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + CirPtr pCir = CIRPTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0; + int imlines = (pScrn->videoRam * 1024) / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + + + if (!pCir->DGAnumModes) { + ErrorF("DGAINIT\n"); + pMode = firstMode = pScrn->modes; + while (pMode) { + newmodes = xrealloc(modes, (num + 1) * sizeof (DGAModeRec)); + if (!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; + currentMode = modes + num; + num++; + (void)memset(currentMode, 1, sizeof(DGAModeRec)); + currentMode->mode = pMode; + currentMode->flags = DGA_PIXMAP_AVAILABLE + | ((!pCir->NoAccel) ? (DGA_FILL_RECT | DGA_BLIT_RECT) : 0); + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; /* The granularity of x and y pos. */ + currentMode->yViewportStep = 1; + currentMode->viewportFlags = 0 /*DGA_FLIP_RETRACE*/; + currentMode->offset = 0; + currentMode->address = pCir->FbBase; + currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->pixmapWidth = currentMode->imageWidth + = pScrn->displayWidth; + currentMode->pixmapHeight = currentMode->imageHeight = imlines; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if(pMode == firstMode) + break; + } + pCir->DGAnumModes = num; + pCir->DGAModes = modes; + } + return DGAInit(pScreen, &CirDGAFuncs, pCir->DGAModes, pCir->DGAnumModes); +} + +static Bool +Cir_OpenFramebuffer( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *flags +){ + CirPtr pCir = CIRPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char*)pCir->FbAddress; + *size = pCir->FbMapSize; + *offset = 0; /* Always */ + *flags = 0; /* Root permissions OS-dependent */ + + return TRUE; +} + + +static Bool +Cir_SetMode( + ScrnInfoPtr pScrn, + DGAModePtr pMode +){ + CirPtr pCir = CIRPTR(pScrn); + static int OldDisplayWidth[MAXSCREENS]; + int index = pScrn->pScreen->myNum; + Bool ret = FALSE; + + if(!pMode) { /* restore the original mode */ + /* put the ScreenParameters back */ + pScrn->displayWidth = OldDisplayWidth[index]; + ret = pCir->DGAModeInit(xf86Screens[index], pScrn->currentMode); + pCir->DGAactive = FALSE; + } else { + if(!pCir->DGAactive) { /* save the old parameters */ + OldDisplayWidth[index] = pScrn->displayWidth; + + pCir->DGAactive = TRUE; + } + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); + + ret = pCir->DGAModeInit(xf86Screens[index], pMode->mode); + } + return ret; +} + +static void +Cir_SetViewport( + ScrnInfoPtr pScrn, + int x, int y, + int flags +){ + CirPtr pCir = CIRPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + + while((hwp->readST01(hwp) & 0x08)); + while(!(hwp->readST01(hwp) & 0x08)); + + pCir->DGAViewportStatus = 0; /* AdjustFrame loops until finished */ +} + +static int +Cir_GetViewport( + ScrnInfoPtr pScrn +){ + CirPtr pCir = CIRPTR(pScrn); + + return pCir->DGAViewportStatus; +} + + + +static void +Cir_Sync( + ScrnInfoPtr pScrn +){ + CirPtr pCir = CIRPTR(pScrn); + + if(pCir->AccelInfoRec) { + (*pCir->AccelInfoRec->Sync)(pScrn); + } +} + +static void +Cir_FillRect ( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned long color +){ + CirPtr pCir = CIRPTR(pScrn); + + if(pCir->AccelInfoRec) { + (*pCir->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); + (*pCir->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(pCir->AccelInfoRec); + } +} + +static void +Cir_BlitRect( + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty +){ + CirPtr pCir = CIRPTR(pScrn); + + if(pCir->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pCir->AccelInfoRec->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pCir->AccelInfoRec->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(pCir->AccelInfoRec); + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp deleted file mode 100644 index a115c5106..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp,v 1.5 2000/12/11 20:18:09 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CIRRUS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -cirrus \- Cirrus Logic video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qcirrus\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B cirrus -is an XFree86 driver for Cirrus Logic video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B cirrus -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp deleted file mode 100644 index 78bc29bfe..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp,v 1.5 2000/12/11 20:18:10 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CYRIX __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -cyrix \- Cyrix video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qcyrix\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B cyrix -is an XFree86 driver for Cyrix video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B cyrix -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp deleted file mode 100644 index d64701b92..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp +++ /dev/null @@ -1,56 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp,v 1.4 1999/08/22 13:04:25 dawes Exp $ -.TH FBDEV __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -fbdev \- video driver for framebuffer device -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""fbdev""" -.br -.BI " BusID ""pci:" bus : dev : func """ -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B fbdev -is an XFree86 driver for framebuffer devices. This is a non-accelerated -driver, the following framebuffer depths are supported: 8, 15, 16, 24. -All visual types are supported for depth 8, and TrueColor visual is -supported for the other depths. Multi-head configurations are supported. -.SH SUPPORTED HARDWARE -The -.B fbdev -driver supports all hardware where a framebuffer driver is available. -fbdev uses the os-specific submodule fbdevhw(__drivermansuffix__) to talk -to the kernel -device driver. Currently a fbdevhw module is available for linux. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to -this driver. -.PP -For this driver it is not required to specify modes in the screen -section of the config file. The -.B fbdev -driver can pick up the currently used video mode from the framebuffer -driver and will use it if there are no video modes configured. -.PP -For PCI boards you might have to add a BusID line to the Device -section. See above for a sample line. You can use "XFree86 -scanpci" -to figure out the correct values. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option ""ShadowFB"" """ boolean """ -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: on. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), -X(1), fbdevhw(__drivermansuffix__) -.SH AUTHORS -Authors include: Gerd Knorr diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp b/xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp deleted file mode 100644 index 6213314be..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp +++ /dev/null @@ -1,298 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp,v 1.6 1999/08/28 10:43:35 dawes Exp $ -.TH GLIDE __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -glide \- Glide video driver -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""glide""" -.br -\ \ ... -.br -.B EndSection -.SH READ THIS IF NOTHING ELSE -This driver has a special requirement that needs to be fulfilled -before it will work: You need Glide installed and you need to make a link for the libglide2x.so -file. Read the second paragraph in the description below to find out how. -.SH DESCRIPTION -.B glide -is an XFree86 driver for Glide capable video boards (such as 3Dfx -Voodoo boards). This driver is mainly for Voodoo 1 and Voodoo 2 boards, later -boards from 3Dfx have 2D built-in and you should preferably use a driver separate for -those boards or the fbdev(__drivermansuffix__) driver. -This driver is a bit special because Voodoo 1 and 2 boards are -very much NOT made for running 2D graphics. Therefore, this driver -uses no hardware acceleration (since there is no acceleration for 2D, -only 3D). Instead it is implemented with the help of a "shadow" -framebuffer that resides entirely in RAM. Selected portions of this -shadow framebuffer are then copied out to the Voodoo board at the right -time. Because of this, the speed of the driver is very dependent on -the CPU. But since the CPU is nowadays actually rather fast at moving -data, we get very good speed anyway, especially since the whole shadow -framebuffer is in cached RAM. -.PP -This driver requires that you have installed Glide. (Which can, at the -time of this writing, be found at -http://glide.xxedgexx.com/3DfxRPMS.html). Also, you need to tell -XFree86 where the libglide2x.so file is placed by making a soft link -in the /usr/X11R6/lib/modules directory that points to the libglide2x.so -file. For example (if your libglide2x.so file is in /usr/lib): -.PP - # ln -s /usr/lib/libglide2x.so /usr/X11R6/lib/modules -.PP -If you have installed /dev/3dfx, the driver will be able to turn on -the MTRR registers (through the glide library) if you have a CPU with -such registers (see http://glide.xxedgexx.com/MTRR.html). This will -speed up copying data to the Voodoo board by as much as 2.7 times and -is very noticeable since this driver copies a lot of -data... Highly recommended. -.PP -This driver supports 16 and 24 bit color modes. The 24 bit color mode -uses a 32 bit framebuffer (it has no support for 24 bit packed-pixel -framebuffers). Notice that the Voodoo boards can only display 16 bit -color, but the shadow framebuffer can be run in 24 bit color. The -point of supporting 24 bit mode is that this enables you to run in a -multihead configuration with Xinerama together with another board that -runs in real 24 bit color mode. (All boards must run the same color -depth when you use Xinerama). -.PP -Resolutions supported are: 640x480, 800x600, 960x720, 1024x768, -1280x1024 and 1600x1200. Note that not all modes will work on all -Voodoo boards. It seems that Voodoo 2 boards support no higher than -1024x768 and Voodoo 1 boards can go to 800x600. If you see a message like this in the output from the server: -.PP - (EE) GLIDE(0): grSstWinOpen returned ... -.PP -Then you are probably trying to use a resolution that is supported by -the driver but not supported by the hardware. -.PP -Refresh rates supported are: 60Hz, 75Hz and 85Hz. The refresh rate -used is derived from the normal mode line according -to the following table: -.TP 28 -Mode-line refresh rate -Used refresh rate -.TP 28 - 0-74 Hz - 60 Hz -.TP 28 - 74-84 Hz - 75 Hz -.TP 28 - 84- Hz - 85 Hz -.PP -Thus, if you use a modeline that for example has a 70Hz refresh rate -you will only get a 60Hz refresh rate in actuality. -.PP -Selecting which Voodoo board to use with the driver is done by using -an option called "GlideDevice" in the "Device" section. (If you don't -have this option present then the first board found will be selected for that Device section). For -example: To use the first Voodoo board, use a "Device" section like -this, for example: -.PP -Section "Device" -.br - Identifier "Voodoo" -.br - Driver "glide" -.br - Option "dpms" "on" -.br - Option "GlideDevice" "0" -.br -EndSection -.PP -And if you have more than one Voodoo board, add another "Device" -section with a GlideDevice option with value 1, and so on. (You can use more than one -Voodoo board, but SLI configured boards will be treated as a single board.) -.PP -Multihead and Xinerama configurations are supported. -.PP -Limited support for DPMS screen saving is available. The "standby" and -"suspend" modes are just painting the screen black. The "off" mode turns -the Voodoo board off and thus works correctly. -.PP -This driver does not support a virtual screen size different from the display size. -.SH SUPPORTED HARDWARE -The -.B glide -driver supports any board that can be used with Glide (such as 3Dfx Voodoo boards) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option ""OnAtExit"" """ boolean """ -If true, will leave the Voodoo board on when the server exits. Useful in a multihead setup when -only the Voodoo board is connected to a second monitor and you don't want that monitor to lose -signal when you quit the server. Put this option in the Device section. -Default: off. -.TP -.BI "Option ""GlideDevice"" """ integer """ -Selects which Voodoo board to use. (Or boards, in an SLI configuration). -The value should be 0 for the first board, 1 for the second and so on. -If it is not present, the first Voodoo board found will be selected. -Put this option in the Device section. -.SH "EXAMPLE" -Here is an example of a part of an XF86Config file that uses a multihead -configuration with two monitors. The first monitor is driven by the -fbdev video driver and the second monitor is driven by the glide -driver. -.PP -.br -Section "Monitor" -.br - Identifier "Monitor 1" -.br - VendorName "Unknown" -.br - ModelName "Unknown" -.br - HorizSync 30-70 -.br - VertRefresh 50-80 -.br - -.br - # 1024x768 @ 76 Hz, 62.5 kHz hsync -.br - Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 -.br -EndSection -.br - -.br -Section "Monitor" -.br - Identifier "Monitor 2" -.br - VendorName "Unknown" -.br - ModelName "Unknown" -.br - HorizSync 30-70 -.br - VertRefresh 50-80 -.br - -.br - # 1024x768 @ 76 Hz, 62.5 kHz hsync -.br - Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 -.br -EndSection -.br - -.br -Section "Device" -.br - Identifier "fb" -.br - Driver "fbdev" -.br - Option "shadowfb" -.br - Option "dpms" "on" -.br - # My video card is on the AGP bus which is usually -.br - # located as PCI bus 1, device 0, function 0. -.br - BusID "PCI:1:0:0" -.br -EndSection -.br - -.br -Section "Device" -.br - # I have a Voodoo 2 board -.br - Identifier "Voodoo" -.br - Driver "glide" -.br - Option "dpms" "on" -.br - # The next line says I want to use the first board. -.br - Option "GlideDevice" "0" -.br -EndSection -.br - -.br -Section "Screen" -.br - Identifier "Screen 1" -.br - Device "fb" -.br - Monitor "Monitor 1" -.br - DefaultDepth 16 -.br - Subsection "Display" -.br - Depth 16 -.br - Modes "1024x768" -.br - EndSubSection -.br -EndSection -.br - -.br -Section "Screen" -.br - Identifier "Screen 2" -.br - Device "Voodoo" -.br - Monitor "Monitor 2" -.br - DefaultDepth 16 -.br - Subsection "Display" -.br - Depth 16 -.br - Modes "1024x768" -.br - EndSubSection -.br -EndSection -.br - -.br -Section "ServerLayout" -.br - Identifier "Main Layout" -.br - # Screen 1 is to the right and screen 2 is to the left -.br - Screen "Screen 2" -.br - Screen "Screen 1" "" "" "Screen 2" "" -.br -EndSection -.PP -If you use this configuration file and start the server with the -+xinerama command line option, the two monitors will be showing a -single large area where windows can be moved between monitors and -overlap from one monitor to the other. Starting the X server with the -Xinerama extension can be done for example like this: -.PP -$ xinit -- +xinerama -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1) -.SH AUTHORS -Author: Henrik Harmsen. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile index d4978cc14..9583be466 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.29 2000/09/20 00:09:21 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.31 2001/01/31 16:14:51 alanh Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM @@ -14,12 +14,12 @@ DRIINCLUDES=-I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri SRCS = glint_driver.c pm2_dac.c pm2ramdac.c pm2_accel.c pm_dac.c IBMramdac.c \ pm_accel.c tx_dac.c tx_accel.c pm2v_dac.c pm2vramdac.c pm2_video.c \ - pm3_dac.c pm3_accel.c TIramdac.c dualmx_dac.c dualmx_accel.c \ - glint_shadow.c $(DRISRC) sx_accel.c TIdualramdac.c glint_dga.c + pm3_dac.c pm3_accel.c TIramdac.c \ + glint_shadow.c $(DRISRC) sx_accel.c glint_dga.c OBJS = glint_driver.o pm2_dac.o pm2ramdac.o pm2_accel.o pm_dac.o IBMramdac.o \ pm_accel.o tx_dac.o tx_accel.o pm2v_dac.o pm2vramdac.o pm2_video.o \ - pm3_dac.o pm3_accel.o TIramdac.o dualmx_dac.o dualmx_accel.o \ - glint_shadow.o $(DRIOBJ) sx_accel.o TIdualramdac.o glint_dga.o + pm3_dac.o pm3_accel.o TIramdac.o \ + glint_shadow.o $(DRIOBJ) sx_accel.o glint_dga.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -52,7 +52,6 @@ ObjectModuleTarget(glint,$(OBJS)) InstallObjectModule(glint,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(glint,) InstallModuleManPage(glint) #endif @@ -61,9 +60,6 @@ DependTarget() InstallDriverSDKNonExecFile(IBMramdac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(TIramdac.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(TIdualramdac.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(dualmx_accel.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(dualmx_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_dri.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_dri.h,$(DRIVERSDKDIR)/drivers/glint) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 index caa5961ee..5a79d688e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 @@ -1,14 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.6 2000/12/12 17:02:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.7 2000/12/20 11:13:01 alanh Exp $ */ STATUS as of Mon, 16 Oct 2000 21:24:51 +0200 Working : * Unaccelerated : Depth 8, 15, 16 and 24 are ok. I tested them upto 1280x1024 only as my monitor don't support higher modes. - * Untested on big endian systems, i had some reports of endianess problems - with a Permedia4 though, so i suppose things are broken for Permedia3 - also. If you encounter problems, please contact me or try with - acceleration disabled. + * Endianess clean, thanks to Romain Dolbeau <dolbeaur@club-internet.fr> for + helping me debug this. * HW cursor. * ShadowFb works. * Full 2D Accels. @@ -65,7 +63,7 @@ Video Overlay [NOTHING DONE YET] : * I have not done anything yet here. -DRI/3D Accels [NOTHING DONE YET] : +DRI/3D Accels [WORK IS PLANED] : * First approach would be to use the gamma for one head only (most probably the first head, it could be configurable though). @@ -103,3 +101,4 @@ DRI/3D Accels [NOTHING DONE YET] : sync the gamma also when doing syncs. Not sure where the right place for this is though. Maybe when switching between 2D and 3D ? +Sven Luther <luther@dpt-info.u-strasbg.fr> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c deleted file mode 100644 index 92efb5f13..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 1998 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Modified from IBMramdac.c to support TI RAMDAC routines - * by Jens Owen, <jens@precisioninsight.com>. - * - * glintOutTIIndReg() and glintInTIIndReg() are used to access - * the indirect TI RAMDAC registers only. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c,v 1.1 2000/03/21 21:46:27 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "TI.h" -#include "glint_regs.h" -#include "glint.h" - -#define TI_WRITE_ADDR 0x4000 -#define TI_RAMDAC_DATA 0x4008 -#define TI_PIXEL_MASK 0x4010 -#define TI_READ_ADDR 0x4018 -#define TI_CURS_COLOR_WRITE_ADDR 0x4020 -#define TI_CURS_COLOR_DATA 0x4028 -#define TI_CURS_COLOR_READ_ADDR 0x4038 -#define TI_DIRECT_CURS_CTRL 0x4048 -#define TI_INDEX_DATA 0x4050 -#define TI_CURS_RAM_DATA 0x4058 -#define TI_CURS_X_LOW 0x4060 -#define TI_CURS_X_HIGH 0x4068 -#define TI_CURS_Y_LOW 0x4070 -#define TI_CURS_Y_HIGH 0x4078 - -void -DUALglintOutTIIndReg(ScrnInfoPtr pScrn, - CARD32 reg, unsigned char mask, unsigned char data) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char tmp = 0x00; - int offset; - - if ((reg & 0xf0) == 0xa0) { /* this is really a direct register write */ - offset = TI_WRITE_ADDR + ((reg & 0xf) << 3); - if (mask != 0x00) - tmp = GLINT_SECONDARY_READ_REG(offset) & mask; - - GLINT_SECONDARY_SLOW_WRITE_REG(tmp | data, offset); - } - else { /* normal indirect access */ - GLINT_SECONDARY_SLOW_WRITE_REG(reg & 0xFF, TI_WRITE_ADDR); - - if (mask != 0x00) - tmp = GLINT_SECONDARY_READ_REG(TI_INDEX_DATA) & mask; - - GLINT_SECONDARY_SLOW_WRITE_REG(tmp | data, TI_INDEX_DATA); - } -} - -unsigned char -DUALglintInTIIndReg (ScrnInfoPtr pScrn, CARD32 reg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char ret; - int offset; - - if ((reg & 0xf0) == 0xa0) { /* this is really a direct register write */ - offset = TI_WRITE_ADDR + ((reg & 0xf) << 3); - ret = GLINT_SECONDARY_READ_REG(offset); - } - else { /* normal indirect access */ - GLINT_SECONDARY_SLOW_WRITE_REG(reg & 0xFF, TI_WRITE_ADDR); - ret = GLINT_SECONDARY_READ_REG(TI_INDEX_DATA); - } - - return (ret); -} - -void -DUALglintTIWriteAddress (ScrnInfoPtr pScrn, CARD32 index) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(index, TI_WRITE_ADDR); -} - -void -DUALglintTIWriteData (ScrnInfoPtr pScrn, unsigned char data) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(data, TI_RAMDAC_DATA); -} - -void -DUALglintTIReadAddress (ScrnInfoPtr pScrn, CARD32 index) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(0xFF, TI_PIXEL_MASK); - GLINT_SECONDARY_SLOW_WRITE_REG(index, TI_READ_ADDR); -} - -unsigned char -DUALglintTIReadData (ScrnInfoPtr pScrn) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - return(GLINT_SECONDARY_READ_REG(TI_RAMDAC_DATA)); -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c deleted file mode 100644 index fa93a2905..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c +++ /dev/null @@ -1,1003 +0,0 @@ -/* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * Dirk Hohndel, <hohndel@suse.de> - * Stefan Dirsch, <sndirsch@suse.de> - * - * Dual MX accelerated options. - * - * Modified version of tx_accel.c to support dual MX chips by - * Jens Owen, <jens@precisioninsight.com> - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c,v 1.9 2000/06/21 13:35:51 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "fb.h" - -#include "miline.h" - -#include "glint_regs.h" -#include "glint.h" - -#include "xaalocal.h" /* For replacements */ - -static void DualMXSync(ScrnInfoPtr pScrn); -static void DualMXSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void DualMXSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void DualMXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, - int patterny, - int fg, int bg, int rop, - unsigned int planemask); -static void DualMXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, - int w, int h); -static void DualMXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color); -static void DualMXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, - int x2, int y2, int w, int h); -static void DualMXWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, - int skipleft, int fg, int bg, int rop, - unsigned int planemask); -static void DualMXSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, - int x2,int y2); -static void DualMXDisableClipping(ScrnInfoPtr pScrn); -static void DualMXWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int trans, - int bpp, int depth); -static void DualMXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void DualMXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); -static void DualMXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void DualMXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); -static void DualMXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -static void DualMXLoadCoord(ScrnInfoPtr pScrn, int x, int y, int w, int h, - int a, int d); -static void DualMXSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void DualMXSubsequentHorVertLine(ScrnInfoPtr pScrn, int x1, int y1, - int len, int dir); -static void DualMXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, int dmaj, int dmin, int e, - int len, int octant); -static void DualMXPolylinesThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, - int mode, int npt, DDXPointPtr pPts); -static void DualMXPolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, - int nseg, xSegment *pSeg); - -#define MAX_FIFO_ENTRIES 15 - -void -DualMXInitializeEngine(ScrnInfoPtr pScrn) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->rasterizerMode = RMMultiGLINT; - - /* Initialize the Accelerator Engine to defaults */ - - /* Only write the following registerto the first MX */ - GLINT_SLOW_WRITE_REG(1, BroadcastMask); - GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); - - /* Only write the following register to the second MX */ - GLINT_SLOW_WRITE_REG(2, BroadcastMask); - GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); - - /* Make sure the rest of the register writes go to both MX's */ - GLINT_SLOW_WRITE_REG(3, BroadcastMask); - - GLINT_SLOW_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); - GLINT_SLOW_WRITE_REG(pGlint->pprod | LBRM_ScanlineInt2, LBReadMode); - pGlint->pprod |= FBRM_ScanlineInt2; - GLINT_SLOW_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_SLOW_WRITE_REG(0, dXSub); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWriteMode); - GLINT_SLOW_WRITE_REG(UNIT_ENABLE, FBWriteMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureColorMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureReadMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTWindow); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LineStippleMode); - GLINT_SLOW_WRITE_REG(0, UpdateLineStippleCounters); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0x400, FilterMode); - GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); - GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, WindowOrigin); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBWindowBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWindowBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PatternRamMode); - - switch (pScrn->bitsPerPixel) { - case 8: - GLINT_SLOW_WRITE_REG(0x2, PixelSize); - break; - case 16: - GLINT_SLOW_WRITE_REG(0x1, PixelSize); - break; - case 32: - GLINT_SLOW_WRITE_REG(0x0, PixelSize); - break; - } - - pGlint->ROP = 0xFF; - pGlint->ClippingOn = FALSE; - pGlint->startxsub = 0; - pGlint->startxdom = 0; - pGlint->starty = 0; - pGlint->count = 0; - pGlint->dxdom = 0; - pGlint->dy = 1; - pGlint->planemask = 0; - GLINT_SLOW_WRITE_REG(0, StartXSub); - GLINT_SLOW_WRITE_REG(0, StartXDom); - GLINT_SLOW_WRITE_REG(0, StartY); - GLINT_SLOW_WRITE_REG(0, GLINTCount); - GLINT_SLOW_WRITE_REG(0, dXDom); - GLINT_SLOW_WRITE_REG(1<<16, dY); -} - -Bool -DualMXAccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - GLINTPtr pGlint = GLINTPTR(pScrn); - long memory = pGlint->FbMapSize; - BoxRec AvailFBArea; - - pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - DualMXInitializeEngine(pScrn); - - infoPtr->Flags = PIXMAP_CACHE | - LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS; - - infoPtr->Sync = DualMXSync; - - infoPtr->SetClippingRectangle = DualMXSetClippingRectangle; - infoPtr->DisableClipping = DualMXDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_MONO_8x8_FILL | -#if 0 - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | -#endif - HARDWARE_CLIP_SOLID_FILL; - - infoPtr->SolidFillFlags = 0; - infoPtr->SetupForSolidFill = DualMXSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = DualMXSubsequentFillRectSolid; - - infoPtr->SolidLineFlags = 0; - infoPtr->PolySegmentThinSolidFlags = 0; - infoPtr->PolylinesThinSolidFlags = 0; - infoPtr->SetupForSolidLine = DualMXSetupForSolidLine; - infoPtr->SubsequentSolidHorVertLine = DualMXSubsequentHorVertLine; - if (!(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)) - { - infoPtr->SubsequentSolidBresenhamLine = - DualMXSubsequentSolidBresenhamLine; - } - infoPtr->PolySegmentThinSolid = DualMXPolySegmentThinSolidWrapper; - infoPtr->PolylinesThinSolid = DualMXPolylinesThinSolidWrapper; - -#if 0 - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | - ONLY_LEFT_TO_RIGHT_BITBLT; - infoPtr->SetupForScreenToScreenCopy = DualMXSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = DualMXSubsequentScreenToScreenCopy; -#endif - - infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS; - infoPtr->SetupForMono8x8PatternFill = DualMXSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - DualMXSubsequentMono8x8PatternFillRect; - -#if 0 - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - TRANSPARENCY_ONLY | -#if 0 - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | -#endif - BIT_ORDER_IN_BYTE_LSBFIRST; - - pGlint->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = - pGlint->XAAScanlineColorExpandBuffers; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - DualMXSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - DualMXSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - DualMXSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | - SYNC_AFTER_COLOR_EXPAND | - CPU_TRANSFER_PAD_DWORD | -#if 0 - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | -#endif - BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - DualMXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - DualMXSubsequentCPUToScreenColorExpandFill; - } -#endif - - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; - - infoPtr->WriteBitmap = DualMXWriteBitmap; - infoPtr->WritePixmap = DualMXWritePixmap; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - if (memory > (16383*1024)) memory = 16383*1024; - AvailFBArea.y2 = memory / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - xf86InitFBManager(pScreen, &AvailFBArea); - - return (XAAInit(pScreen, infoPtr)); -} - -static void DualMXLoadCoord( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int a, int d -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WRITE_REG(w<<16, StartXSub); - GLINT_WRITE_REG(x<<16,StartXDom); - GLINT_WRITE_REG(y<<16,StartY); - GLINT_WRITE_REG(h,GLINTCount); - GLINT_WRITE_REG(a<<16,dXDom); - GLINT_WRITE_REG(d<<16,dY); -} - -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - -#define Sync_tag 0x188 - -static void -DualMXSync( - ScrnInfoPtr pScrn -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned long readValue; - - CHECKCLIPPING; - - while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(3); - GLINT_WRITE_REG(3, BroadcastMask); /* hack! this shouldn't need to be reloaded */ - GLINT_WRITE_REG(1<<10, FilterMode); - GLINT_WRITE_REG(0, GlintSync); - - /* Read 1st MX until Sync Tag shows */ - do { - while(GLINT_READ_REG(OutFIFOWords) == 0); - readValue = GLINT_READ_REG(OutputFIFO); -#ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "1st MX: OutputFIFO %x\n",readValue); -#endif - } while (readValue != Sync_tag); - - /* Read 2nd MX until Sync Tag shows */ - do { - while(GLINT_SECONDARY_READ_REG(OutFIFOWords) == 0); - readValue = GLINT_SECONDARY_READ_REG(OutputFIFO); -#ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "2nd MX: OutputFIFO %x\n",readValue); -#endif - } while (readValue != Sync_tag); - -#ifdef DEBUG - if (GLINT_READ_REG(OutFIFOWords)||GLINT_SECONDARY_READ_REG(OutFIFOWords)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unread data in output FIFO after sync\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "1st MX: OutFifoWords %d\n",GLINT_READ_REG(OutFIFOWords)); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "2nd MX: OutFifoWords %d\n",GLINT_SECONDARY_READ_REG(OutFIFOWords)); - } -#endif -} - -static void -DualMXSetupForFillRectSolid( - ScrnInfoPtr pScrn, - int color, int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - pGlint->ForeGroundColor = color; - - GLINT_WAIT(5); - REPLICATE(color); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(color, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(color, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); -} - -static void -DualMXSubsequentFillRectSolid( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(8); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode,Render); -} - -static void -DualMXSetClippingRectangle( - ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2 -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(3); - GLINT_WRITE_REG((y1&0xFFFF)<<16|(x1&0xFFFF), ScissorMinXY); - GLINT_WRITE_REG((y2&0xFFFF)<<16|(x2&0xFFFF), ScissorMaxXY); - GLINT_WRITE_REG(1, ScissorMode); /* Enable Scissor Mode */ - pGlint->ClippingOn = TRUE; -} - -static void -DualMXDisableClipping( - ScrnInfoPtr pScrn -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - CHECKCLIPPING; -} - -static void -DualMXSetupForScreenToScreenCopy( - ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->BltScanDirection = ydir; - - GLINT_WAIT(5); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod | FBRM_SrcEnable, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_SrcEnable | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentScreenToScreenCopy( - ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int srcaddr, dstaddr; - - GLINT_WAIT(10); - if (pGlint->BltScanDirection != 1) { - y1 += h - 1; - y2 += h - 1; - DualMXLoadCoord(pScrn, x2, y2, x2+w, h, 0, -1); - } else { - DualMXLoadCoord(pScrn, x2, y2, x2+w, h, 0, 1); - } - - srcaddr = y1 * pScrn->displayWidth + x1; - dstaddr = y2 * pScrn->displayWidth + x2; - - GLINT_WRITE_REG(srcaddr - dstaddr, FBSourceOffset); - GLINT_WRITE_REG(PrimitiveTrapezoid| FastFillEnable | SpanOperation, Render); -} - -static void -DualMXSetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - REPLICATE(bg); - GLINT_WAIT(6); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - pGlint->FrameBufferReadMode = FastFillEnable; - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - GLINT_WRITE_REG(fg, PatternRamData0); - } - LOADROP(rop); -} - -static void -DualMXSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ - -#if 0 - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); -#endif - - pGlint->cpucount = y; - pGlint->cpuheight = h; - GLINT_WAIT(6); - DualMXLoadCoord(pScrn, x, pGlint->cpucount, x+w, 1, 0, 1); -} - -static void -DualMXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *src; - int dwords = pGlint->dwords; - - GLINT_WAIT(7); - DualMXLoadCoord(pScrn, pGlint->startxdom, pGlint->cpucount, pGlint->startxsub, 1, 0, 1); - - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | SyncOnBitMask, - Render); - - src = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; - while (dwords >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, - infoRec->ColorExpandRange - 1); - dwords -= (infoRec->ColorExpandRange - 1); - src += (infoRec->ColorExpandRange - 1); - } - if (dwords) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); - } - pGlint->cpucount += 1; -#if 0 - if (pGlint->cpucount == (pGlint->cpuheight + 1)) - CHECKCLIPPING; -#endif -} - -static void -DualMXSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(fg, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(fg, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); -} - -static void -DualMXSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - -#if 0 - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); -#endif - - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); -} - -void DualMXSetupForMono8x8PatternFill( - ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - if (bg == -1) pGlint->FrameBufferReadMode = -1; - else pGlint->FrameBufferReadMode = 0; - pGlint->ForeGroundColor = fg; - pGlint->BackGroundColor = bg; - REPLICATE(pGlint->ForeGroundColor); - REPLICATE(pGlint->BackGroundColor); - - GLINT_WAIT(13); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG((patternx & 0x000000FF), AreaStipplePattern0); - GLINT_WRITE_REG((patternx & 0x0000FF00) >> 8, AreaStipplePattern1); - GLINT_WRITE_REG((patternx & 0x00FF0000) >> 16, AreaStipplePattern2); - GLINT_WRITE_REG((patternx & 0xFF000000) >> 24, AreaStipplePattern3); - GLINT_WRITE_REG((patterny & 0x000000FF), AreaStipplePattern4); - GLINT_WRITE_REG((patterny & 0x0000FF00) >> 8, AreaStipplePattern5); - GLINT_WRITE_REG((patterny & 0x00FF0000) >> 16, AreaStipplePattern6); - GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7); - - if (rop == GXcopy) { - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentMono8x8PatternFillRect( - ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int span = 0; - - GLINT_WAIT(12); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - - if (pGlint->FrameBufferReadMode != -1) { - if (pGlint->ROP == GXcopy) { - GLINT_WRITE_REG(pGlint->BackGroundColor, FBBlockColor); - span = 0; - } else { - GLINT_WRITE_REG(pGlint->BackGroundColor, PatternRamData0); - span = SpanOperation; - } - GLINT_WRITE_REG(2<<1|2<<4|patternx<<7|patterny<<12|ASM_InvertPattern | - UNIT_ENABLE, AreaStippleMode); - GLINT_WRITE_REG(AreaStippleEnable | span | FastFillEnable | - PrimitiveTrapezoid, Render); - } - - if (pGlint->ROP == GXcopy) { - GLINT_WRITE_REG(pGlint->ForeGroundColor, FBBlockColor); - span = 0; - } else { - GLINT_WRITE_REG(pGlint->ForeGroundColor, PatternRamData0); - span = SpanOperation; - } - GLINT_WRITE_REG(2<<1|2<<4|patternx<<7|patterny<<12| - UNIT_ENABLE, AreaStippleMode); - GLINT_WRITE_REG(AreaStippleEnable | span | FastFillEnable | - PrimitiveTrapezoid, Render); -} - -static void -DualMXWriteBitmap(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char *srcpntr; - int dwords, height, mode; - Bool SecondPass = FALSE; - register int count; - register CARD32* pattern; - - w += skipleft; - x -= skipleft; - dwords = (w + 31) >> 5; - - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); - - GLINT_WAIT(11); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - LOADROP(rop); - if (rop == GXcopy) { - mode = 0; - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - mode = SpanOperation; - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - - if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ - REPLICATE(fg); - GLINT_WAIT(3); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } else if(rop == GXcopy) { - REPLICATE(bg); - GLINT_WAIT(5); - if (rop == GXcopy) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, PatternRamData0); - } - GLINT_WRITE_REG(PrimitiveTrapezoid |mode|FastFillEnable,Render); - REPLICATE(fg); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } else { - SecondPass = TRUE; - REPLICATE(fg); - GLINT_WAIT(3); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } - -SECOND_PASS: - GLINT_WRITE_REG(PrimitiveTrapezoid | FastFillEnable | mode | SyncOnBitMask, Render); - - height = h; - srcpntr = src; - while(height--) { - count = dwords >> 3; - pattern = (CARD32*)srcpntr; - while(count--) { - GLINT_WAIT(8); - GLINT_WRITE_REG(*(pattern), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+1), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+2), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+3), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+4), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+5), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+6), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+7), BitMaskPattern); - pattern+=8; - } - count = dwords & 0x07; - GLINT_WAIT(count); - while (count--) - GLINT_WRITE_REG(*(pattern++), BitMaskPattern); - srcpntr += srcwidth; - } - - if(SecondPass) { - SecondPass = FALSE; - REPLICATE(bg); - GLINT_WAIT(4); - GLINT_WRITE_REG((pGlint->rasterizerMode|InvertBitMask), RasterizerMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, PatternRamData0); - } - goto SECOND_PASS; - } - - GLINT_WAIT(2); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - CHECKCLIPPING; - SET_SYNC_FLAG(infoRec); -} - -static void -DualMXWritePixmap( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, /* bytes */ - int rop, - unsigned int planemask, - int trans, - int bpp, int depth -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *srcp; - int count,dwords, skipleft, Bpp = bpp >> 3; - - if((skipleft = (long)src & 0x03L)) { - skipleft /= Bpp; - - x -= skipleft; - w += skipleft; - - src = (unsigned char*)((long)src & ~0x03L); - } - - switch(Bpp) { - case 1: dwords = (w + 3) >> 2; - break; - case 2: dwords = (w + 1) >> 1; - break; - case 4: dwords = w; - break; - default: return; - } - - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); - - GLINT_WAIT(12); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, PatternRamMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | FastFillEnable | SpanOperation | - SyncOnHostData, Render); - - while(h--) { - count = dwords; - srcp = (CARD32*)src; - while(count >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, infoRec->ColorExpandRange - 1); - count -= infoRec->ColorExpandRange - 1; - srcp += infoRec->ColorExpandRange - 1; - } - if(count) { - GLINT_WAIT(count); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, count); - } - src += srcwidth; - } - CHECKCLIPPING; - SET_SYNC_FLAG(infoRec); -} - -static void -DualMXPolylinesThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pPts -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - GLINTPtr pGlint = GLINTPTR(infoRec->pScrn); - pGlint->CurrentGC = pGC; - pGlint->CurrentDrawable = pDraw; - if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn); - XAAPolyLines(pDraw, pGC, mode, npt, pPts); -} - -static void -DualMXPolySegmentThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - GLINTPtr pGlint = GLINTPTR(infoRec->pScrn); - pGlint->CurrentGC = pGC; - pGlint->CurrentDrawable = pDraw; - if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn); - XAAPolySegment(pDraw, pGC, nseg, pSeg); -} - -static void -DualMXSetupForSolidLine(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(5); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(color, GLINTColor); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentHorVertLine(ScrnInfoPtr pScrn,int x,int y,int len,int dir) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(7); - if (dir == DEGREES_0) { - DualMXLoadCoord(pScrn, x, y, 0, len, 1, 0); - } else { - DualMXLoadCoord(pScrn, x, y, 0, len, 0, 1); - } - - GLINT_WRITE_REG(PrimitiveLine, Render); -} - -static void -DualMXSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn, - int x, int y, int dmaj, int dmin, int e, int len, int octant) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dxdom, dy; - - if(dmaj == dmin) { - GLINT_WAIT(7); - if(octant & YDECREASING) { - dy = -1; - } else { - dy = 1; - } - - if(octant & XDECREASING) { - dxdom = -1; - } else { - dxdom = 1; - } - - DualMXLoadCoord(pScrn, x, y, 0, len, dxdom, dy); - GLINT_WRITE_REG(PrimitiveLine, Render); - return; - } - - fbBres(pGlint->CurrentDrawable, pGlint->CurrentGC, 0, - (octant & XDECREASING) ? -1 : 1, - (octant & YDECREASING) ? -1 : 1, - (octant & YMAJOR) ? Y_AXIS : X_AXIS, - x, y, dmin + e, dmin, -dmaj, len); -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c deleted file mode 100644 index d042bfa47..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c +++ /dev/null @@ -1,807 +0,0 @@ -/* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Original Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * Dirk Hohndel, <hohndel@suse.de> - * Stefan Dirsch, <sndirsch@suse.de> - * Helmut Fahrion, <hf@suse.de> - * - * Modified version of tx_dac.c to support Dual MX rasterizers by - * Jens Owen <jens@precisioninsight.com> - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c,v 1.4 2000/05/10 18:55:28 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "IBM.h" -#include "TI.h" -#include "glint_regs.h" -#include "glint.h" - -#define DEBUG -#ifdef DEBUG -#define DUMP(name,field) do { \ - value = GLINT_READ_REG(field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s(primary): 0x%lX\n", name, value); \ - value = GLINT_SECONDARY_READ_REG(field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s(secondary): 0x%lX\n", name, value); \ -} while (0) - -#define TIDUMP(name,field) do { \ - value = glintInTIIndReg(pScrn,field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s: 0x%lX\n", name, value); \ -} while (0) - -void -GLINTDumpRegs(ScrnInfoPtr pScrn) { - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned long value; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tGAMMA/MX regs:\n"); - DUMP("ResetStatus",ResetStatus); - DUMP("IntEnable",IntEnable); - DUMP("IntFlags",IntFlags); - DUMP("InFIFOSpace",InFIFOSpace); - DUMP("OutFIFOWords",OutFIFOWords); - DUMP("DMAAddress",DMAAddress); - DUMP("DMACount",DMACount); - DUMP("ErrorFlags",ErrorFlags); - DUMP("VClkCtl",VClkCtl); - DUMP("TestRegister",TestRegister); - DUMP("Aperture0",Aperture0); - DUMP("Aperture1",Aperture1); - DUMP("DMAControl",DMAControl); - DUMP("FIFODis",FIFODis); - DUMP("LBMemoryCtl",LBMemoryCtl); - DUMP("LBMemoryEDO",LBMemoryEDO); - DUMP("FBMemoryCtl",FBMemoryCtl); - DUMP("FBModeSel",FBModeSel); - DUMP("FBGCWrMask",FBGCWrMask); - DUMP("FBGCColorLower",FBGCColorLower); - DUMP("FBTXMemCtl",FBTXMemCtl); - DUMP("FBWrMaskk",FBWrMaskk); - DUMP("FBGCColorUpper",FBGCColorUpper); - DUMP("OutputFIFO",OutputFIFO); - DUMP("VTGHLimit",VTGHLimit); - DUMP("VTGHSyncStart",VTGHSyncStart); - DUMP("VTGHSyncEnd",VTGHSyncEnd); - DUMP("VTGHBlankEnd",VTGHBlankEnd); - DUMP("VTGVLimit",VTGVLimit); - DUMP("VTGVSyncStart",VTGVSyncStart); - DUMP("VTGVSyncEnd",VTGVSyncEnd); - DUMP("VTGVBlankEnd",VTGVBlankEnd); - DUMP("VTGHGateStart",VTGHGateStart); - DUMP("VTGHGateEnd",VTGHGateEnd); - DUMP("VTGVGateStart",VTGVGateStart); - DUMP("VTGVGateEnd",VTGVGateEnd); - DUMP("VTGPolarity",VTGPolarity); - DUMP("VTGFrameRowAddr",VTGFrameRowAddr); - DUMP("VTGVLineNumber",VTGVLineNumber); - DUMP("VTGSerialClk",VTGSerialClk); - DUMP("VTGModeCtl",VTGModeCtl); - DUMP("GInFIFOSpace",GInFIFOSpace); - DUMP("GDMAAddress",GDMAAddress); - DUMP("GDMAControl",GDMAControl); - DUMP("GOutDMA",GOutDMA); - DUMP("GOutDMACount",GOutDMACount); - DUMP("GResetStatus",GResetStatus); - DUMP("GIntEnable",GIntEnable); - DUMP("GIntFlags",GIntFlags); - DUMP("GErrorFlags",GErrorFlags); - DUMP("GTestRegister",GTestRegister); - DUMP("GFIFODis",GFIFODis); - DUMP("GChipConfig",GChipConfig); - DUMP("GCSRAperture",GCSRAperture); - DUMP("GPageTableAddr",GPageTableAddr); - DUMP("GPageTableLength",GPageTableLength); - DUMP("GDelayTimer",GDelayTimer); - DUMP("GCommandMode",GCommandMode); - DUMP("GCommandIntEnable",GCommandIntEnable); - DUMP("GCommandIntFlags",GCommandIntFlags); - DUMP("GCommandErrorFlags",GCommandErrorFlags); - DUMP("GCommandStatus",GCommandStatus); - DUMP("GCommandFaultingAddr",GCommandFaultingAddr); - DUMP("GVertexFaultingAddr",GVertexFaultingAddr); - DUMP("GWriteFaultingAddr",GWriteFaultingAddr); - DUMP("GFeedbackSelectCount",GFeedbackSelectCount); - DUMP("GGammaProcessorMode",GGammaProcessorMode); - DUMP("GVGAShadow",GVGAShadow); - DUMP("GMultGLINTAperture",GMultGLINTAperture); - DUMP("GMultGLINT1",GMultGLINT1); - DUMP("GMultGLINT2",GMultGLINT2); - DUMP("StartXDom",StartXDom); - DUMP("dXDom",dXDom); - DUMP("StartXSub",StartXSub); - DUMP("dXSub",dXSub); - DUMP("StartY",StartY); - DUMP("dY",dY); - DUMP("GLINTCount",GLINTCount); - DUMP("Render",Render); - DUMP("ContinueNewLine",ContinueNewLine); - DUMP("ContinueNewDom",ContinueNewDom); - DUMP("ContinueNewSub",ContinueNewSub); - DUMP("Continue",Continue); - DUMP("FlushSpan",FlushSpan); - DUMP("BitMaskPattern",BitMaskPattern); - DUMP("PointTable0",PointTable0); - DUMP("PointTable1",PointTable1); - DUMP("PointTable2",PointTable2); - DUMP("PointTable3",PointTable3); - DUMP("RasterizerMode",RasterizerMode); - DUMP("YLimits",YLimits); - DUMP("ScanLineOwnership",ScanLineOwnership); - DUMP("WaitForCompletion",WaitForCompletion); - DUMP("PixelSize",PixelSize); - DUMP("XLimits",XLimits); - DUMP("RectangleOrigin",RectangleOrigin); - DUMP("RectangleSize",RectangleSize); - DUMP("PackedDataLimits",PackedDataLimits); - DUMP("ScissorMode",ScissorMode); - DUMP("ScissorMinXY",ScissorMinXY); - DUMP("ScissorMaxXY",ScissorMaxXY); - DUMP("ScreenSize",ScreenSize); - DUMP("AreaStippleMode",AreaStippleMode); - DUMP("LineStippleMode",LineStippleMode); - DUMP("LoadLineStippleCounters",LoadLineStippleCounters); - DUMP("UpdateLineStippleCounters",UpdateLineStippleCounters); - DUMP("SaveLineStippleState",SaveLineStippleState); - DUMP("WindowOrigin",WindowOrigin); - DUMP("AreaStipplePattern0",AreaStipplePattern0); - DUMP("AreaStipplePattern1",AreaStipplePattern1); - DUMP("AreaStipplePattern2",AreaStipplePattern2); - DUMP("AreaStipplePattern3",AreaStipplePattern3); - DUMP("AreaStipplePattern4",AreaStipplePattern4); - DUMP("AreaStipplePattern5",AreaStipplePattern5); - DUMP("AreaStipplePattern6",AreaStipplePattern6); - DUMP("AreaStipplePattern7",AreaStipplePattern7); - DUMP("TextureAddressMode",TextureAddressMode); - DUMP("TextureReadMode",TextureReadMode); - DUMP("TextureFormat",TextureFormat); - DUMP("TextureCacheControl",TextureCacheControl); - DUMP("GLINTBorderColor",GLINTBorderColor); - DUMP("TexelLUTIndex",TexelLUTIndex); - DUMP("TexelLUTData",TexelLUTData); - DUMP("Texel0",Texel0); - DUMP("Texel1",Texel1); - DUMP("Texel2",Texel2); - DUMP("Texel3",Texel3); - DUMP("Texel4",Texel4); - DUMP("Texel5",Texel5); - DUMP("Texel6",Texel6); - DUMP("Texel7",Texel7); - DUMP("Interp0",Interp0); - DUMP("Interp1",Interp1); - DUMP("Interp2",Interp2); - DUMP("Interp3",Interp3); - DUMP("Interp4",Interp4); - DUMP("TextureFilter",TextureFilter); - DUMP("TexelLUTMode",TexelLUTMode); - DUMP("TextureColorMode",TextureColorMode); - DUMP("TextureEnvColor",TextureEnvColor); - DUMP("FogMode",FogMode); - DUMP("FogColor",FogColor); - DUMP("FStart",FStart); - DUMP("dFdx",dFdx); - DUMP("dFdyDom",dFdyDom); - DUMP("KsStart",KsStart); - DUMP("dKsdx",dKsdx); - DUMP("dKsdyDom",dKsdyDom); - DUMP("KdStart", KdStart ); - DUMP("dKdStart", dKdStart); - DUMP("dKddyDom", dKddyDom); - DUMP("RStart", RStart ); - DUMP("dRdx", dRdx); - DUMP("dRdyDom", dRdyDom ); - DUMP("GStart", GStart ); - DUMP("dGdx", dGdx ); - DUMP("dGdyDom", dGdyDom ); - DUMP("BStart", BStart ); - DUMP("dBdx", dBdx ); - DUMP("dBdyDom", dBdyDom ); - DUMP("AStart", AStart ); - DUMP("dAdx", dAdx ); - DUMP("dAdyDom", dAdyDom ); - DUMP("ColorDDAMode", ColorDDAMode ); - DUMP("ConstantColor", ConstantColor ); - DUMP("GLINTColor", GLINTColor); - DUMP("AlphaTestMode", AlphaTestMode ); - DUMP("AntialiasMode", AntialiasMode); - DUMP("AlphaBlendMode", AlphaBlendMode); - DUMP("DitherMode", DitherMode ); - DUMP("FBSoftwareWriteMask", FBSoftwareWriteMask); - DUMP("LogicalOpMode", LogicalOpMode ); - DUMP("FBWriteData", FBWriteData); - DUMP("RouterMode", RouterMode); - DUMP("LBReadMode", LBReadMode); - DUMP("LBReadFormat", LBReadFormat); - DUMP("LBSourceOffset", LBSourceOffset); - DUMP("LBStencil", LBStencil); - DUMP("LBDepth", LBDepth ); - DUMP("LBWindowBase", LBWindowBase); - DUMP("LBWriteMode", LBWriteMode); - DUMP("LBWriteFormat", LBWriteFormat); - DUMP("TextureData", TextureData ); - DUMP("TextureDownloadOffset", TextureDownloadOffset); - DUMP("GLINTWindow", GLINTWindow ); - DUMP("StencilMode", StencilMode); - DUMP("StencilData", StencilData); - DUMP("GLINTStencil", GLINTStencil ); - DUMP("DepthMode", DepthMode); - DUMP("GLINTDepth", GLINTDepth ); - DUMP("ZStartU", ZStartU ); - DUMP("ZStartL", ZStartL ); - DUMP("dZdxU", dZdxU); - DUMP("dZdxL", dZdxL); - DUMP("dZdyDomU",dZdyDomU ); - DUMP("dZdyDomL", dZdyDomL); - DUMP("FastClearDepth", FastClearDepth); - DUMP("FBReadMode", FBReadMode); - DUMP("FBSourceOffset", FBSourceOffset ); - DUMP("FBPixelOffset", FBPixelOffset); - DUMP("FBColor", FBColor ); - DUMP("FBData", FBData); - DUMP("FBSourceData", FBSourceData ); - DUMP("FBWindowBase", FBWindowBase ); - DUMP("FBWriteMode", FBWriteMode ); - DUMP("FBHardwareWriteMask", FBHardwareWriteMask ); - DUMP("FBBlockColor", FBBlockColor ); - DUMP("FBReadPixel", FBReadPixel); - DUMP("PatternRamMode", PatternRamMode ); - DUMP("PatternRamData0", PatternRamData0 ); - DUMP("PatternRamData1", PatternRamData1); - DUMP("PatternRamData2", PatternRamData2 ); - DUMP("PatternRamData3", PatternRamData3 ); - DUMP("PatternRamData4", PatternRamData4); - DUMP("PatternRamData5", PatternRamData5 ); - DUMP("PatternRamData6", PatternRamData6 ); - DUMP("PatternRamData7", PatternRamData7 ); - DUMP("FilterMode", FilterMode ); - DUMP("StatisticMode", StatisticMode); - DUMP("MinRegion", MinRegion ); - DUMP("MaxRegion", MaxRegion ); - DUMP("ResetPickResult", ResetPickResult ); - DUMP("MitHitRegion", MitHitRegion ); - DUMP("MaxHitRegion", MaxHitRegion ); - DUMP("PickResult", PickResult ); - DUMP("GlintSync", GlintSync); - DUMP("FBBlockColorU", FBBlockColorU ); - DUMP("FBBlockColorL", FBBlockColorL ); - DUMP("SuspendUntilFrameBlank", SuspendUntilFrameBlank ); - DUMP("FBSourceBase", FBSourceBase ); - DUMP("FBSourceDelta", FBSourceDelta); - DUMP("Config", Config ); - DUMP("YUVMode", YUVMode ); - DUMP("DrawTriangle", DrawTriangle); - DUMP("RepeatTriangle", RepeatTriangle); - DUMP("DrawLine01", DrawLine01); - DUMP("DrawLine10", DrawLine10 ); - DUMP("RepeatLine", RepeatLine ); - DUMP("BroadcastMask", BroadcastMask ); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 direct regs:\n"); -#define TI_WRITE_ADDR 0x4000 -#define TI_RAMDAC_DATA 0x4008 -#define TI_PIXEL_MASK 0x4010 -#define TI_READ_ADDR 0x4018 -#define TI_CURS_COLOR_WRITE_ADDR 0x4020 -#define TI_CURS_COLOR_DATA 0x4028 -#define TI_CURS_COLOR_READ_ADDR 0x4038 -#define TI_DIRECT_CURS_CTRL 0x4048 -#define TI_INDEX_DATA 0x4050 -#define TI_CURS_RAM_DATA 0x4058 -#define TI_CURS_X_LOW 0x4060 -#define TI_CURS_X_HIGH 0x4068 -#define TI_CURS_Y_LOW 0x4070 -#define TI_CURS_Y_HIGH 0x4078 - DUMP("TI_WRITE_ADDR", TI_WRITE_ADDR); - DUMP("TI_RAMDAC_DATA", TI_RAMDAC_DATA); - DUMP("TI_PIXEL_MASK", TI_PIXEL_MASK); - DUMP("TI_READ_ADDR", TI_READ_ADDR); - DUMP("TI_CURS_COLOR_WRITE_ADDR", TI_CURS_COLOR_WRITE_ADDR); - DUMP("TI_CURS_COLOR_DATA", TI_CURS_COLOR_DATA); - DUMP("TI_CURS_COLOR_READ_ADDR", TI_CURS_COLOR_READ_ADDR); - DUMP("TI_DIRECT_CURS_CTRL", TI_DIRECT_CURS_CTRL); - DUMP("TI_INDEX_DATA", TI_INDEX_DATA); - DUMP("TI_CURS_RAM_DATA", TI_CURS_RAM_DATA); - DUMP("TI_CURS_X_LOW", TI_CURS_X_LOW); - DUMP("TI_CURS_X_HIGH", TI_CURS_X_HIGH); - DUMP("TI_CURS_Y_LOW", TI_CURS_Y_LOW); - DUMP("TI_CURS_Y_HIGH", TI_CURS_Y_HIGH); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 indirect regs:\n"); - TIDUMP("TIDAC_rev",TIDAC_rev); - TIDUMP("TIDAC_ind_curs_ctrl",TIDAC_ind_curs_ctrl); - TIDUMP("TIDAC_byte_router_ctrl",TIDAC_byte_router_ctrl); - TIDUMP("TIDAC_latch_ctrl",TIDAC_latch_ctrl); - TIDUMP("TIDAC_true_color_ctrl",TIDAC_true_color_ctrl); - TIDUMP("TIDAC_multiplex_ctrl",TIDAC_multiplex_ctrl); - TIDUMP("TIDAC_clock_select",TIDAC_clock_select); - TIDUMP("TIDAC_palette_page",TIDAC_palette_page); - TIDUMP("TIDAC_general_ctrl",TIDAC_general_ctrl); - TIDUMP("TIDAC_misc_ctrl",TIDAC_misc_ctrl); - TIDUMP("TIDAC_pll_addr",TIDAC_pll_addr); - TIDUMP("TIDAC_pll_pixel_data",TIDAC_pll_pixel_data); - TIDUMP("TIDAC_pll_memory_data",TIDAC_pll_memory_data); - TIDUMP("TIDAC_pll_loop_data",TIDAC_pll_loop_data); - TIDUMP("TIDAC_key_over_low",TIDAC_key_over_low); - TIDUMP("TIDAC_key_over_high",TIDAC_key_over_high); - TIDUMP("TIDAC_key_red_low",TIDAC_key_red_low); - TIDUMP("TIDAC_key_red_high",TIDAC_key_red_high); - TIDUMP("TIDAC_key_green_low",TIDAC_key_green_low); - TIDUMP("TIDAC_key_green_high",TIDAC_key_green_high); - TIDUMP("TIDAC_key_blue_low",TIDAC_key_blue_low); - TIDUMP("TIDAC_key_blue_high",TIDAC_key_blue_high); - TIDUMP("TIDAC_key_ctrl",TIDAC_key_ctrl); - TIDUMP("TIDAC_clock_ctrl",TIDAC_clock_ctrl); - TIDUMP("TIDAC_sense_test",TIDAC_sense_test); - TIDUMP("TIDAC_test_mode_data",TIDAC_test_mode_data); - TIDUMP("TIDAC_crc_remain_lsb",TIDAC_crc_remain_lsb); - TIDUMP("TIDAC_crc_remain_msb",TIDAC_crc_remain_msb); - TIDUMP("TIDAC_crc_bit_select",TIDAC_crc_bit_select); - TIDUMP("TIDAC_id",TIDAC_id); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 PLL regs:\n"); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Pixel N",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x01); - TIDUMP("Pixel M",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x02); - TIDUMP("Pixel P",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Memory N",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x04); - TIDUMP("Memory M",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x08); - TIDUMP("Memory P",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Loop N",TIDAC_pll_loop_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x10); - TIDUMP("Loop M",TIDAC_pll_loop_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x20); - TIDUMP("Loop P",TIDAC_pll_loop_data); -} -#endif - -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - int logbytesperaccess; - - if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || - (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) - logbytesperaccess = 4; - else - logbytesperaccess = 3; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - -Bool -DualMXInit(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; - RamDacHWRecPtr pTI = RAMDACHWPTR(pScrn); - RamDacRegRecPtr ramdacReg = &pTI->ModeReg; - CARD32 temp1, temp2, temp3, temp4; - - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; - - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) | 0x01; - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; - else - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x03; - } else { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) & 0xFFFFFFFE; - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; - } - - temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; - temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; - temp3 = mode->CrtcHSyncEnd - mode->CrtcHSyncStart; - temp4 = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - - pReg->glintRegs[VTGHLimit >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); - pReg->glintRegs[VTGHSyncEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); - pReg->glintRegs[VTGHSyncStart >> 3] = Shiftbpp(pScrn, temp1); - pReg->glintRegs[VTGHBlankEnd >> 3] = Shiftbpp(pScrn, mode->CrtcHTotal - - mode->CrtcHDisplay); - - pReg->glintRegs[VTGVLimit >> 3] = mode->CrtcVTotal; - pReg->glintRegs[VTGVSyncEnd >> 3] = temp2 + temp4; - pReg->glintRegs[VTGVSyncStart >> 3] = temp2; - pReg->glintRegs[VTGVBlankEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; - -#if 1 /* We force them high */ - pReg->glintRegs[VTGPolarity >> 3] = 0xBA; -#else - pReg->glintRegs[VTGPolarity >> 3] = (((mode->Flags & V_PHSYNC) ? 0:2)<<2) | - ((mode->Flags & V_PVSYNC) ? 0 : 2) | (0xb0); -#endif - - pReg->glintRegs[VClkCtl >> 3] = 0; - pReg->glintRegs[VTGVGateStart >> 3] = pReg->glintRegs[VTGVBlankEnd>>3] - 1; - pReg->glintRegs[VTGVGateEnd >> 3] = pReg->glintRegs[VTGVBlankEnd>>3]; - /* - * tell DAC to use the ICD chip clock 0 as ref clock - * and set up some more video timing generator registers - */ - pReg->glintRegs[VTGHGateStart >> 3] = pReg->glintRegs[VTGHBlankEnd>>3] - 1; - pReg->glintRegs[VTGHGateEnd >> 3] = pReg->glintRegs[VTGHLimit>>3] - 1; - pReg->glintRegs[VTGSerialClk >> 3] = 0x0002; - pReg->glintRegs[FBModeSel >> 3] = 0x907; - pReg->glintRegs[VTGModeCtl >> 3] = 0x04; - - /* - * Setup memory control registers for FB and LB - */ - pReg->glintRegs[FBMemoryCtl >> 3] = 0x00000800; - pReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); - pReg->glintRegs[LBMemoryEDO >> 3] &= ~(LBEDOMask | - LBEDOBankSizeMask | - LBTwoPageDetectorMask); - pReg->glintRegs[LBMemoryEDO >> 3] |= (LBEDOEnabled | - LBEDOBankSize4M | - LBTwoPageDetector); - pReg->glintRegs[LBMemoryCtl >> 3] = GLINT_READ_REG(LBMemoryCtl); - pReg->glintRegs[LBMemoryCtl >> 3] &= ~(LBNumBanksMask | - LBPageSizeMask | - LBRASCASLowMask | - LBRASPrechargeMask | - LBCASLowMask | - LBPageModeMask | - LBRefreshCountMask); - pReg->glintRegs[LBMemoryCtl >> 3] |= (LBNumBanks2 | - LBPageSize1024 | - LBRASCASLow2 | - LBRASPrecharge2 | - LBCASLow1 | - LBPageModeEnabled | - (0x20 << LBRefreshCountShift)); - pReg->glintRegs[GCSRAperture >> 3] = GCSRSecondaryGLINTMapEn; - - /* - * Setup HW - * - * Note: The order of discovery for the MX devices is dependent - * on which way the resource allocation code decides to scan the - * bus. This setup assumes the first MX found owns the even - * scanlines. Should the implementation change an scan the bus - * in the opposite direction, then simple invert the indices for - * MXPciInfo below. If this is setup wrong, the bug will appear - * as incorrect scanline interleaving when software rendering. - */ - pReg->glintRegs[GMultGLINTAperture >> 3] = pGlint->realMXWidth; - pReg->glintRegs[GMultGLINT1 >> 3] = - pGlint->MXPciInfo[0]->memBase[2] & 0xFF800000; - pReg->glintRegs[GMultGLINT2 >> 3] = - pGlint->MXPciInfo[1]->memBase[2] & 0xFF800000; - - /* Copy info to secondary regs */ - pReg->glintSecondRegs[Aperture0>>3] = pReg->glintRegs[Aperture0>>3]; - pReg->glintSecondRegs[Aperture1>>3] = pReg->glintRegs[Aperture1>>3]; - - pReg->glintSecondRegs[DFIFODis>>3] = pReg->glintRegs[DFIFODis>>3]; - pReg->glintSecondRegs[FIFODis>>3] = pReg->glintRegs[FIFODis>>3]; - pReg->glintSecondRegs[VTGHLimit>>3] = pReg->glintRegs[VTGHLimit>>3]; - pReg->glintSecondRegs[VTGHSyncEnd>>3] = pReg->glintRegs[VTGHSyncEnd>>3]; - pReg->glintSecondRegs[VTGHSyncStart>>3] = pReg->glintRegs[VTGHSyncStart>>3]; - pReg->glintSecondRegs[VTGHBlankEnd>>3] = pReg->glintRegs[VTGHBlankEnd>>3]; - pReg->glintSecondRegs[VTGVLimit>>3] = pReg->glintRegs[VTGVLimit>>3]; - pReg->glintSecondRegs[VTGVSyncEnd>>3] = pReg->glintRegs[VTGVSyncEnd>>3]; - pReg->glintSecondRegs[VTGVSyncStart>>3] = pReg->glintRegs[VTGVSyncStart>>3]; - pReg->glintSecondRegs[VTGVBlankEnd>>3] = pReg->glintRegs[VTGVBlankEnd>>3]; - pReg->glintSecondRegs[VTGPolarity>>3] = pReg->glintRegs[VTGPolarity>>3]; - pReg->glintSecondRegs[VClkCtl>>3] = pReg->glintRegs[VClkCtl>>3]; - pReg->glintSecondRegs[VTGVGateStart>>3] = pReg->glintRegs[VTGVGateStart>>3]; - pReg->glintSecondRegs[VTGVGateEnd>>3] = pReg->glintRegs[VTGVGateEnd>>3]; - pReg->glintSecondRegs[VTGSerialClk>>3] = pReg->glintRegs[VTGSerialClk>>3]; - pReg->glintSecondRegs[VTGHGateStart>>3] = pReg->glintRegs[VTGHGateStart>>3]; - pReg->glintSecondRegs[VTGHGateEnd>>3] = pReg->glintRegs[VTGHGateEnd>>3]; - pReg->glintSecondRegs[FBModeSel>>3] = pReg->glintRegs[FBModeSel>>3]; - pReg->glintSecondRegs[VTGModeCtl>>3] = pReg->glintRegs[VTGModeCtl>>3]; - pReg->glintSecondRegs[FBMemoryCtl>>3] = pReg->glintRegs[FBMemoryCtl>>3]; - pReg->glintSecondRegs[LBMemoryEDO>>3] = pReg->glintRegs[LBMemoryEDO>>3]; - pReg->glintSecondRegs[LBMemoryCtl>>3] = pReg->glintRegs[LBMemoryCtl>>3]; - pReg->glintSecondRegs[GCSRAperture>>3] = pReg->glintRegs[GCSRAperture>>3]; - pReg->glintSecondRegs[GMultGLINTAperture>>3] = - pReg->glintRegs[GMultGLINTAperture>>3]; - pReg->glintSecondRegs[GMultGLINT1>>3] = pReg->glintRegs[GMultGLINT1>>3]; - pReg->glintSecondRegs[GMultGLINT2>>3] = pReg->glintRegs[GMultGLINT2>>3]; - - switch (pGlint->RamDac->RamDacType) { - case TI3030_RAMDAC: - case TI3026_RAMDAC: - { - /* Get the programmable clock values */ - unsigned long m=0,n=0,p=0; - unsigned long clock; - int count; - unsigned long q, status, VCO; - - clock = TIramdacCalculateMNPForClock(pGlint->RefClock, - mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p); - - ramdacReg->DacRegs[TIDAC_PIXEL_N] = ((n & 0x3f) | 0xc0); - ramdacReg->DacRegs[TIDAC_PIXEL_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_PIXEL_P] = ((p & 0x03) | 0xb0); - ramdacReg->DacRegs[TIDAC_PIXEL_VALID] = TRUE; - - if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) - n = 65 - ((64 << 2) / pScrn->bitsPerPixel); - else - n = 65 - ((128 << 2) / pScrn->bitsPerPixel); - m = 61; - p = 0; - for (q = 0; q < 8; q++) { - if (q > 0) p = 3; - for ( ; p < 4; p++) { - VCO = ((clock * (q + 1) * (65 - m)) / (65 - n)) << (p + 1); - if (VCO >= 110000) { break; } - } - if (VCO >= 110000) { break; } - } - ramdacReg->DacRegs[TIDAC_clock_ctrl] = (q | 0x38); - - ramdacReg->DacRegs[TIDAC_LOOP_N] = ((n & 0x3f) | 0xc0); - ramdacReg->DacRegs[TIDAC_LOOP_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_LOOP_P] = ((p & 0x03) | 0xf0); - ramdacReg->DacRegs[TIDAC_LOOP_VALID] = TRUE; - } - break; - } - - /* Now use helper routines to setup bpp for this driver */ - (*pGlint->RamDac->SetBpp)(pScrn, ramdacReg); - - return(TRUE); -} - -void -DualMXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); - glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); - - glintReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis); - glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); - - glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); - glintReg->glintRegs[VTGPolarity >> 3] = GLINT_READ_REG(VTGPolarity); - glintReg->glintRegs[VTGHLimit >> 3] = GLINT_READ_REG(VTGHLimit); - glintReg->glintRegs[VTGHBlankEnd >> 3] = GLINT_READ_REG(VTGHBlankEnd); - glintReg->glintRegs[VTGHSyncStart >> 3] = GLINT_READ_REG(VTGHSyncStart); - glintReg->glintRegs[VTGHSyncEnd >> 3] = GLINT_READ_REG(VTGHSyncEnd); - glintReg->glintRegs[VTGVLimit >> 3] = GLINT_READ_REG(VTGVLimit); - glintReg->glintRegs[VTGVBlankEnd >> 3] = GLINT_READ_REG(VTGVBlankEnd); - glintReg->glintRegs[VTGVSyncStart >> 3] = GLINT_READ_REG(VTGVSyncStart); - glintReg->glintRegs[VTGVSyncEnd >> 3] = GLINT_READ_REG(VTGVSyncEnd); - glintReg->glintRegs[VTGVGateStart >> 3] = GLINT_READ_REG(VTGVGateStart); - glintReg->glintRegs[VTGVGateEnd >> 3] = GLINT_READ_REG(VTGVGateEnd); - glintReg->glintRegs[VTGSerialClk >> 3] = GLINT_READ_REG(VTGSerialClk); - glintReg->glintRegs[FBModeSel >> 3] = GLINT_READ_REG(FBModeSel); - glintReg->glintRegs[VTGModeCtl >> 3] = GLINT_READ_REG(VTGModeCtl); - glintReg->glintRegs[VTGHGateStart >> 3] = GLINT_READ_REG(VTGHGateStart); - glintReg->glintRegs[VTGHGateEnd >> 3] = GLINT_READ_REG(VTGHGateEnd); - glintReg->glintRegs[FBMemoryCtl >> 3] = GLINT_READ_REG(FBMemoryCtl); - glintReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); - glintReg->glintRegs[LBMemoryCtl >> 3] = GLINT_READ_REG(LBMemoryCtl); - glintReg->glintRegs[GCSRAperture >> 3] = GLINT_READ_REG(GCSRAperture); - glintReg->glintRegs[GMultGLINTAperture>>3] = - GLINT_READ_REG(GMultGLINTAperture); - glintReg->glintRegs[GMultGLINT1>>3] = GLINT_READ_REG(GMultGLINT1); - glintReg->glintRegs[GMultGLINT2>>3] = GLINT_READ_REG(GMultGLINT2); - - glintReg->glintSecondRegs[Aperture0 >> 3] = - GLINT_SECONDARY_READ_REG(Aperture0); - glintReg->glintSecondRegs[Aperture1 >> 3] = - GLINT_SECONDARY_READ_REG(Aperture1); - - glintReg->glintSecondRegs[DFIFODis >> 3] = - GLINT_SECONDARY_READ_REG(DFIFODis); - glintReg->glintSecondRegs[FIFODis >> 3] = - GLINT_SECONDARY_READ_REG(FIFODis); - - glintReg->glintSecondRegs[VClkCtl >> 3] = - GLINT_SECONDARY_READ_REG(VClkCtl); - glintReg->glintSecondRegs[VTGPolarity >> 3] = - GLINT_SECONDARY_READ_REG(VTGPolarity); - glintReg->glintSecondRegs[VTGHLimit >> 3] = - GLINT_SECONDARY_READ_REG(VTGHLimit); - glintReg->glintSecondRegs[VTGHBlankEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHBlankEnd); - glintReg->glintSecondRegs[VTGHSyncStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGHSyncStart); - glintReg->glintSecondRegs[VTGHSyncEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHSyncEnd); - glintReg->glintSecondRegs[VTGVLimit >> 3] = - GLINT_SECONDARY_READ_REG(VTGVLimit); - glintReg->glintSecondRegs[VTGVBlankEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVBlankEnd); - glintReg->glintSecondRegs[VTGVSyncStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGVSyncStart); - glintReg->glintSecondRegs[VTGVSyncEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVSyncEnd); - glintReg->glintSecondRegs[VTGVGateStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGVGateStart); - glintReg->glintSecondRegs[VTGVGateEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVGateEnd); - glintReg->glintSecondRegs[VTGSerialClk >> 3] = - GLINT_SECONDARY_READ_REG(VTGSerialClk); - glintReg->glintSecondRegs[FBModeSel >> 3] = - GLINT_SECONDARY_READ_REG(FBModeSel); - glintReg->glintSecondRegs[VTGModeCtl >> 3] = - GLINT_SECONDARY_READ_REG(VTGModeCtl); - glintReg->glintSecondRegs[VTGHGateStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGHGateStart); - glintReg->glintSecondRegs[VTGHGateEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHGateEnd); - glintReg->glintSecondRegs[FBMemoryCtl >> 3] = - GLINT_SECONDARY_READ_REG(FBMemoryCtl); - glintReg->glintSecondRegs[LBMemoryEDO >> 3] = - GLINT_SECONDARY_READ_REG(LBMemoryEDO); - glintReg->glintSecondRegs[LBMemoryCtl >> 3] = - GLINT_SECONDARY_READ_REG(LBMemoryCtl); - glintReg->glintSecondRegs[GCSRAperture >> 3] = - GLINT_SECONDARY_READ_REG(GCSRAperture); - glintReg->glintSecondRegs[GMultGLINTAperture>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINTAperture); - glintReg->glintSecondRegs[GMultGLINT1>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINT1); - glintReg->glintSecondRegs[GMultGLINT2>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINT2); -} - -void -DualMXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGPolarity >> 3], VTGPolarity); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGSerialClk >> 3], VTGSerialClk); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGModeCtl >> 3], VTGModeCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHLimit >> 3], VTGHLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncStart >> 3],VTGHSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncEnd >> 3], VTGHSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHBlankEnd >> 3], VTGHBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVLimit >> 3], VTGVLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncStart >> 3],VTGVSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncEnd >> 3], VTGVSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVBlankEnd >> 3], VTGVBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateStart >> 3],VTGVGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateEnd >> 3], VTGVGateEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FBModeSel >> 3], FBModeSel); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateStart >> 3],VTGHGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateEnd >> 3], VTGHGateEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FBMemoryCtl >> 3], FBMemoryCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[LBMemoryEDO >> 3], LBMemoryEDO); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[LBMemoryCtl >> 3], LBMemoryCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GCSRAperture >> 3], GCSRAperture); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINTAperture >> 3], - GMultGLINTAperture); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINT1 >> 3], GMultGLINT1); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINT2 >> 3], GMultGLINT2); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[Aperture0 >> 3], Aperture0); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[Aperture1 >> 3], Aperture1); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[DFIFODis >> 3], DFIFODis); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FIFODis >> 3], FIFODis); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGPolarity >> 3], VTGPolarity); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGSerialClk >> 3], VTGSerialClk); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGModeCtl >> 3], VTGModeCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHLimit >> 3], VTGHLimit); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHSyncStart >> 3],VTGHSyncStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHSyncEnd >> 3], VTGHSyncEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHBlankEnd >> 3], VTGHBlankEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVLimit >> 3], VTGVLimit); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVSyncStart >> 3],VTGVSyncStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVSyncEnd >> 3], VTGVSyncEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVBlankEnd >> 3], VTGVBlankEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVGateStart >> 3],VTGVGateStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVGateEnd >> 3], VTGVGateEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FBModeSel >> 3], FBModeSel); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHGateStart >> 3],VTGHGateStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHGateEnd >> 3], VTGHGateEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FBMemoryCtl >> 3], FBMemoryCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[LBMemoryEDO >> 3], LBMemoryEDO); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[LBMemoryCtl >> 3], LBMemoryCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GCSRAperture >> 3], GCSRAperture); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINTAperture >>3], GMultGLINTAperture); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINT1 >> 3], GMultGLINT1); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINT2 >> 3], GMultGLINT2); -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp deleted file mode 100644 index 00ba3b542..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp +++ /dev/null @@ -1,114 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp,v 1.10 2000/12/11 20:18:13 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH GLINT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -glint \- GLINT/Permedia video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qglint\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B glint -is an XFree86 driver for 3Dlabs & Texas Instruments GLINT/Permedia based video -cards. The driver is rather fully accelerated, and provides support for the -following framebuffer depths: 8, 15 (may give bad results with FBDev support), -16, 24 (32 bpp recommended, 24 bpp has problems), 30, and an 8+24 overlay mode. -.SH SUPPORTED HARDWARE -The -.B glint -driver supports 3Dlabs (GLINT MX, GLINT 500TX, GLINT GAMMA, Permedia, -Permedia 2, Permedia 2v, Permedia 3) and Texas Instruments (Permedia, -Permedia 2) chips. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"ti_pm2", "ti_pm", "pm3", "pm2v", "pm2", "pm", "500tx", "mx", "gamma". -.RE -.PP -The driver will try to auto-detect the amount of video memory present for all -chips. If it's not detected correctly, the actual amount of video memory should -be specified with a -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -Additionally, you may need to specify the bus ID of your card with a -.B BusID -entry in the config file -.B \*qDevice\*q -section, especially with FBDev support. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the SW cursor. Default: off. -This option disables the -.B HWCursor -option and vice versa. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24, 32 bpp. -.RB ( Note: -This hasn't been tested with FBDev support and probably won't work.) -Recognized values are: "8,24", "24,8". Default: off. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. -.RB ( Note: -This doesn't work with Permedia2 based cards for Amigas.) Default: off. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. -.RB ( Note: -This disables hardware acceleration.) Default: off. -.TP -.BI "Option \*qUseFBDev\*q \*q" boolean \*q -Enable or disable use of an OS-specific fb interface (which is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.ig -.TP -.BI "Option \*qRGBbits\*q \*q" integer \*q -Each gun of the RGB triple can have either 8 or 10 bits. Default: 8 -.. -.TP -.BI "Option \*qBlockWrite\*q \*q" boolean \*q -Enable or disable block writes for the various Permedia 2 chips. This improves -acceleration in general, but disables it for some special cases. Default: off. -.TP -.BI "Option \*qFireGL3000\*q \*q" boolean \*q -If you have a card of the same name, turn this on. Default: off. -.TP -.BI "Option \*qSetMClk\*q \*q" freq \*q -The driver will try to auto-detect the memory clock for all chips. If it's not -detected correctly, the actual value (in MHz) should be specified with this -option. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Alan Hourihane, Dirk Hohndel, Stefan Dirsch, Michel Dnzer, -Sven Luther diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h index d7467a00d..52cc1f883 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.37 2000/11/14 17:32:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.44 2001/02/07 13:26:18 alanh Exp $ */ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -45,7 +45,7 @@ #include "glint_dripriv.h" #endif -#define GLINT_MAX_MX_DEVICES 2 +#define GLINT_MAX_MULTI_DEVICES 2 #define GLINT_VGA_MMIO_OFF 0x6000 #define VERSION 4000 @@ -57,21 +57,27 @@ typedef struct { CARD32 glintRegs[0x2000]; - CARD32 glintSecondRegs[0x2000]; - CARD32 DacRegs[0x100]; /* used by internal DACs */ + CARD32 DacRegs[0x100]; CARD8 cmap[0x300]; } GLINTRegRec, *GLINTRegPtr; #define GLINTPTR(p) ((GLINTPtr)((p)->driverPrivate)) typedef struct { + int lastInstance; + int refCount; +} GLINTEntRec, *GLINTEntPtr; + +typedef struct { pciVideoPtr PciInfo; - pciVideoPtr MXPciInfo[GLINT_MAX_MX_DEVICES]; - int numMXDevices; + pciVideoPtr MultiPciInfo[GLINT_MAX_MULTI_DEVICES]; + int numMultiDevices; + int MultiChip; + Bool MultiAperture; PCITAG PciTag; EntityInfoPtr pEnt; + GLINTEntPtr entityPrivate; RamDacHelperRecPtr RamDac; - int MemClock; int Chipset; int ChipRev; int HwBpp; @@ -94,7 +100,7 @@ typedef struct { int cpuheight; int cpucount; int planemask; - int realMXWidth; + int realWidth; CARD32 IOAddress; unsigned long FbAddress; int irq; @@ -102,6 +108,7 @@ typedef struct { unsigned char * IOBaseVGA; unsigned char * FbBase; long FbMapSize; + long IOOffset; DGAModePtr DGAModes; int numDGAModes; Bool DGAactive; @@ -110,47 +117,52 @@ typedef struct { Bool NoAccel; Bool FBDev; Bool ShadowFB; - Bool WriteBitmap; unsigned char * ShadowPtr; int ShadowPitch; Bool Dac6Bit; Bool HWCursor; Bool ClippingOn; - Bool UsePCIRetry; Bool UseBlockWrite; Bool UseFireGL3000; + CARD8 VGAdata[65536]; Bool VGAcore; + Bool STATE; + Bool ScanlineDirect; int MXFbSize; CARD32 rasterizerMode; int MinClock; int MaxClock; int RefClock; - GLINTRegRec SavedReg; - GLINTRegRec ModeReg; + GLINTRegRec SavedReg[GLINT_MAX_MULTI_DEVICES]; + GLINTRegRec ModeReg[GLINT_MAX_MULTI_DEVICES]; CARD32 AccelFlags; CARD32 ROP; CARD32 FrameBufferReadMode; CARD32 BltScanDirection; CARD32 TexMapFormat; CARD32 PixelWidth; + CARD32 FIFOSize; RamDacRecPtr RamDacRec; xf86CursorInfoPtr CursorInfoRec; XAAInfoRecPtr AccelInfoRec; CloseScreenProcPtr CloseScreen; + ScreenBlockHandlerProcPtr BlockHandler; GCPtr CurrentGC; DrawablePtr CurrentDrawable; I2CBusPtr DDCBus, VSBus; + CARD32 FGCursor; + CARD32 BGCursor; + CARD8 HardwareCursorPattern[1024]; CARD8* XAAScanlineColorExpandBuffers[2]; + CARD8* ScratchBuffer; CARD32 RasterizerSwap; + void (*LoadCursorCallback)(ScrnInfoPtr); + void (*CursorColorCallback)(ScrnInfoPtr); + CARD32 PM3_PixelSize; int PM3_Config2D; int PM3_Render2D; int PM3_AreaStippleMode; int PM3_VideoControl; - Bool PM3_UseGamma; - pciVideoPtr PM3_GammaPciInfo; - PCITAG PM3_GammaPciTag; - CARD32 PM3_GammaIOAddress; - unsigned char * PM3_GammaIOBase; #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -212,28 +224,24 @@ void PermediaInitializeEngine(ScrnInfoPtr pScrn); void Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +void Permedia2VPreInit(ScrnInfoPtr pScrn); Bool Permedia2vHWCursorInit(ScreenPtr pScreen); -/* pm3_dac.c */ void Permedia3PreInit(ScrnInfoPtr pScrn); int Permedia3MemorySizeDetect(ScrnInfoPtr pScrn); void Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); -Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode); -/* pm3_accel.c */ -/* Not needed, ... is it ever called outside of pm3_accel.c ? -void Permedia3Sync(ScrnInfoPtr pScrn); -*/ +Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg); Bool Permedia3AccelInit(ScreenPtr pScreen); void Permedia3InitializeEngine(ScrnInfoPtr pScrn); -/* End of pm3 stuff */ void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); -Bool TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +Bool TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr glintReg); Bool TXAccelInit(ScreenPtr pScreen); void TXInitializeEngine(ScrnInfoPtr pScrn); +void SXInitializeEngine(ScrnInfoPtr pScrn); Bool SXAccelInit(ScreenPtr pScreen); void DualMXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); @@ -256,17 +264,17 @@ Bool glintIBM640HWCursorInit(ScreenPtr pScreen); void glintOutTIIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data); unsigned char glintInTIIndReg(ScrnInfoPtr pScrn, CARD32 reg); -void DUALglintOutTIIndReg(ScrnInfoPtr pScrn, +void GMX2000OutIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data); -unsigned char DUALglintInTIIndReg(ScrnInfoPtr pScrn, CARD32 reg); +unsigned char GMX2000InIndReg(ScrnInfoPtr pScrn, CARD32 reg); void glintTIWriteAddress(ScrnInfoPtr pScrn, CARD32 index); void glintTIReadAddress(ScrnInfoPtr pScrn, CARD32 index); void glintTIWriteData(ScrnInfoPtr pScrn, unsigned char data); unsigned char glintTIReadData(ScrnInfoPtr pScrn); -void DUALglintTIWriteAddress(ScrnInfoPtr pScrn, CARD32 index); -void DUALglintTIReadAddress(ScrnInfoPtr pScrn, CARD32 index); -void DUALglintTIWriteData(ScrnInfoPtr pScrn, unsigned char data); -unsigned char DUALglintTIReadData(ScrnInfoPtr pScrn); +void GMX2000WriteAddress(ScrnInfoPtr pScrn, CARD32 index); +void GMX2000ReadAddress(ScrnInfoPtr pScrn, CARD32 index); +void GMX2000WriteData(ScrnInfoPtr pScrn, unsigned char data); +unsigned char GMX2000ReadData(ScrnInfoPtr pScrn); Bool glintTIHWCursorInit(ScreenPtr pScreen); void Permedia2OutIndReg(ScrnInfoPtr pScrn, @@ -282,6 +290,10 @@ void Permedia2LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); void Permedia2LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); +void Permedia3LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); +void Permedia3LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); void Permedia2I2CUDelay(I2CBusPtr b, int usec); void Permedia2I2CPutBits(I2CBusPtr b, int scl, int sda); void Permedia2I2CGetBits(I2CBusPtr b, int *scl, int *sda); @@ -300,6 +312,8 @@ void GLINTAdjustFrame(int scrnIndex, int x, int y, int flags); extern int partprodPermedia[]; +Bool GLINTDGAInit(ScreenPtr pScreen); + Bool GLINTDRIScreenInit(ScreenPtr pScreen); Bool GLINTDRIFinishScreenInit(ScreenPtr pScreen); void GLINTDRICloseScreen(ScreenPtr pScreen); @@ -314,4 +328,10 @@ void GLINT_VERB_WRITE_REG(GLINTPtr, CARD32 v, int r, char *file, int line); CARD32 GLINT_VERB_READ_REG(GLINTPtr, CARD32 r, char *file, int line); void GLINTRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +void GLINT_MoveBYTE(CARD32* dest, unsigned char* src, int dwords); +void GLINT_MoveWORDS(CARD32* dest, unsigned short* src, int dwords); +void GLINT_MoveDWORDS(CARD32* dest, CARD32* src, int dwords); + +int Shiftbpp(ScrnInfoPtr pScrn, int value); #endif /* _GLINT_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c index 2c6ed447f..a82d7da8a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. + * Copyright 2000-2001 by Alan Hourihane, Sychdyn, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.1 2000/05/10 18:55:29 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.2 2001/01/31 16:14:54 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -54,9 +54,8 @@ DGAFunctionRec GLINTDGAFuncs = { GLINT_GetViewport, GLINT_Sync, GLINT_FillRect, - NULL, -#if 0 GLINT_BlitRect, +#if 0 GLINT_BlitTransRect #else NULL diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index 6cf4650f2..2da9bb004 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.18 2000/06/23 23:43:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.21 2001/02/07 13:26:18 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -305,8 +305,9 @@ GLINTInitVisualConfigs(ScreenPtr pScreen) LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBWriteFormat); - if (pGlint->numMXDevices == 2) { - GLINT_SECONDARY_SLOW_WRITE_REG( + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + GLINT_SLOW_WRITE_REG( (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | @@ -314,7 +315,7 @@ GLINTInitVisualConfigs(ScreenPtr pScreen) LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBReadFormat); - GLINT_SECONDARY_SLOW_WRITE_REG( + GLINT_SLOW_WRITE_REG( (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | @@ -322,6 +323,7 @@ GLINTInitVisualConfigs(ScreenPtr pScreen) LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBWriteFormat); + ACCESSCHIP1(); } return TRUE; @@ -361,7 +363,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen) if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA) return FALSE; - if (pGlint->numMXDevices > 2) return FALSE; + if (pGlint->numMultiDevices > 2) return FALSE; pDRIInfo = DRICreateInfoRec(); if(pDRIInfo == NULL) @@ -455,7 +457,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen) } /* Tell the client driver how many MX's we have */ - pGlintDRI->numMXDevices = pGlint->numMXDevices; + pGlintDRI->numMultiDevices = pGlint->numMultiDevices; /* Tell the client about our screen size setup */ pGlintDRI->pprod = pGlint->pprod; @@ -831,68 +833,70 @@ GLINTDRISwapContext( pRC->MX1.CFilterMode = GLINT_READ_REG(FilterMode); pRC->MX1.CStatisticMode = GLINT_READ_REG(StatisticMode); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { pRC->MX1.CBroadcastMask = GLINT_READ_REG(BroadcastMask); - pRC->MX2.CStartXDom = GLINT_SECONDARY_READ_REG(StartXDom); - pRC->MX2.CdXDom = GLINT_SECONDARY_READ_REG(dXDom); - pRC->MX2.CStartXSub = GLINT_SECONDARY_READ_REG(StartXSub); - pRC->MX2.CdXSub = GLINT_SECONDARY_READ_REG(dXSub); - pRC->MX2.CStartY = GLINT_SECONDARY_READ_REG(StartY); - pRC->MX2.CdY = GLINT_SECONDARY_READ_REG(dY); - pRC->MX2.CGLINTCount = GLINT_SECONDARY_READ_REG(GLINTCount); - pRC->MX2.CPointTable0 = GLINT_SECONDARY_READ_REG(PointTable0); - pRC->MX2.CPointTable1 = GLINT_SECONDARY_READ_REG(PointTable1); - pRC->MX2.CPointTable2 = GLINT_SECONDARY_READ_REG(PointTable2); - pRC->MX2.CPointTable3 = GLINT_SECONDARY_READ_REG(PointTable3); - pRC->MX2.CRasterizerMode = GLINT_SECONDARY_READ_REG(RasterizerMode); - pRC->MX2.CYLimits = GLINT_SECONDARY_READ_REG(YLimits); - pRC->MX2.CScanLineOwnership = GLINT_SECONDARY_READ_REG(ScanLineOwnership); - pRC->MX2.CPixelSize = GLINT_SECONDARY_READ_REG(PixelSize); - pRC->MX2.CScissorMode = GLINT_SECONDARY_READ_REG(ScissorMode); - pRC->MX2.CScissorMinXY = GLINT_SECONDARY_READ_REG(ScissorMinXY); - pRC->MX2.CScissorMaxXY = GLINT_SECONDARY_READ_REG(ScissorMaxXY); - pRC->MX2.CScreenSize = GLINT_SECONDARY_READ_REG(ScreenSize); - pRC->MX2.CAreaStippleMode = GLINT_SECONDARY_READ_REG(AreaStippleMode); - pRC->MX2.CLineStippleMode = GLINT_SECONDARY_READ_REG(LineStippleMode); - pRC->MX2.CLoadLineStippleCounters = GLINT_SECONDARY_READ_REG(LoadLineStippleCounters); - pRC->MX2.CWindowOrigin = GLINT_SECONDARY_READ_REG(WindowOrigin); - pRC->MX2.CRouterMode = GLINT_SECONDARY_READ_REG(RouterMode); - pRC->MX2.CTextureAddressMode = GLINT_SECONDARY_READ_REG(TextureAddressMode); - pRC->MX2.CTextureReadMode = GLINT_SECONDARY_READ_REG(TextureReadMode); - pRC->MX2.CTextureColorMode = GLINT_SECONDARY_READ_REG(TextureColorMode); - pRC->MX2.CFogMode = GLINT_SECONDARY_READ_REG(FogMode); - pRC->MX2.CColorDDAMode = GLINT_SECONDARY_READ_REG(ColorDDAMode); - pRC->MX2.CGLINTColor = GLINT_SECONDARY_READ_REG(GLINTColor); - pRC->MX2.CAlphaTestMode = GLINT_SECONDARY_READ_REG(AlphaTestMode); - pRC->MX2.CAntialiasMode = GLINT_SECONDARY_READ_REG(AntialiasMode); - pRC->MX2.CAlphaBlendMode = GLINT_SECONDARY_READ_REG(AlphaBlendMode); - pRC->MX2.CDitherMode = GLINT_SECONDARY_READ_REG(DitherMode); - pRC->MX2.CFBSoftwareWriteMask = GLINT_SECONDARY_READ_REG(FBSoftwareWriteMask); - pRC->MX2.CLogicalOpMode = GLINT_SECONDARY_READ_REG(LogicalOpMode); - pRC->MX2.CFBWriteData = GLINT_SECONDARY_READ_REG(FBWriteData); - pRC->MX2.CLBReadMode = GLINT_SECONDARY_READ_REG(LBReadMode); - pRC->MX2.CLBSourceOffset = GLINT_SECONDARY_READ_REG(LBSourceOffset); - pRC->MX2.CLBWindowBase = GLINT_SECONDARY_READ_REG(LBWindowBase); - pRC->MX2.CLBWriteMode = GLINT_SECONDARY_READ_REG(LBWriteMode); - pRC->MX2.CTextureDownloadOffset = GLINT_SECONDARY_READ_REG(TextureDownloadOffset); - pRC->MX2.CLBWindowOffset = GLINT_SECONDARY_READ_REG(LBWindowOffset); - pRC->MX2.CGLINTWindow = GLINT_SECONDARY_READ_REG(GLINTWindow); - pRC->MX2.CStencilMode = GLINT_SECONDARY_READ_REG(StencilMode); - pRC->MX2.CDepthMode = GLINT_SECONDARY_READ_REG(DepthMode); - pRC->MX2.CGLINTDepth = GLINT_SECONDARY_READ_REG(GLINTDepth); - pRC->MX2.CFBReadMode = GLINT_SECONDARY_READ_REG(FBReadMode); - pRC->MX2.CFBSourceOffset = GLINT_SECONDARY_READ_REG(FBSourceOffset); - pRC->MX2.CFBPixelOffset = GLINT_SECONDARY_READ_REG(FBPixelOffset); - pRC->MX2.CFBWindowBase = GLINT_SECONDARY_READ_REG(FBWindowBase); - pRC->MX2.CFBWriteMode = GLINT_SECONDARY_READ_REG(FBWriteMode); - pRC->MX2.CFBHardwareWriteMask = GLINT_SECONDARY_READ_REG(FBHardwareWriteMask); - pRC->MX2.CFBBlockColor = GLINT_SECONDARY_READ_REG(FBBlockColor); - pRC->MX2.CPatternRamMode = GLINT_SECONDARY_READ_REG(PatternRamMode); - pRC->MX2.CFBBlockColorU = GLINT_SECONDARY_READ_REG(FBBlockColorU); - pRC->MX2.CFBBlockColorL = GLINT_SECONDARY_READ_REG(FBBlockColorL); - pRC->MX2.CFilterMode = GLINT_SECONDARY_READ_REG(FilterMode); - pRC->MX2.CStatisticMode = GLINT_SECONDARY_READ_REG(StatisticMode); + ACCESSCHIP2(); + pRC->MX2.CStartXDom = GLINT_READ_REG(StartXDom); + pRC->MX2.CdXDom = GLINT_READ_REG(dXDom); + pRC->MX2.CStartXSub = GLINT_READ_REG(StartXSub); + pRC->MX2.CdXSub = GLINT_READ_REG(dXSub); + pRC->MX2.CStartY = GLINT_READ_REG(StartY); + pRC->MX2.CdY = GLINT_READ_REG(dY); + pRC->MX2.CGLINTCount = GLINT_READ_REG(GLINTCount); + pRC->MX2.CPointTable0 = GLINT_READ_REG(PointTable0); + pRC->MX2.CPointTable1 = GLINT_READ_REG(PointTable1); + pRC->MX2.CPointTable2 = GLINT_READ_REG(PointTable2); + pRC->MX2.CPointTable3 = GLINT_READ_REG(PointTable3); + pRC->MX2.CRasterizerMode = GLINT_READ_REG(RasterizerMode); + pRC->MX2.CYLimits = GLINT_READ_REG(YLimits); + pRC->MX2.CScanLineOwnership = GLINT_READ_REG(ScanLineOwnership); + pRC->MX2.CPixelSize = GLINT_READ_REG(PixelSize); + pRC->MX2.CScissorMode = GLINT_READ_REG(ScissorMode); + pRC->MX2.CScissorMinXY = GLINT_READ_REG(ScissorMinXY); + pRC->MX2.CScissorMaxXY = GLINT_READ_REG(ScissorMaxXY); + pRC->MX2.CScreenSize = GLINT_READ_REG(ScreenSize); + pRC->MX2.CAreaStippleMode = GLINT_READ_REG(AreaStippleMode); + pRC->MX2.CLineStippleMode = GLINT_READ_REG(LineStippleMode); + pRC->MX2.CLoadLineStippleCounters = GLINT_READ_REG(LoadLineStippleCounters); + pRC->MX2.CWindowOrigin = GLINT_READ_REG(WindowOrigin); + pRC->MX2.CRouterMode = GLINT_READ_REG(RouterMode); + pRC->MX2.CTextureAddressMode = GLINT_READ_REG(TextureAddressMode); + pRC->MX2.CTextureReadMode = GLINT_READ_REG(TextureReadMode); + pRC->MX2.CTextureColorMode = GLINT_READ_REG(TextureColorMode); + pRC->MX2.CFogMode = GLINT_READ_REG(FogMode); + pRC->MX2.CColorDDAMode = GLINT_READ_REG(ColorDDAMode); + pRC->MX2.CGLINTColor = GLINT_READ_REG(GLINTColor); + pRC->MX2.CAlphaTestMode = GLINT_READ_REG(AlphaTestMode); + pRC->MX2.CAntialiasMode = GLINT_READ_REG(AntialiasMode); + pRC->MX2.CAlphaBlendMode = GLINT_READ_REG(AlphaBlendMode); + pRC->MX2.CDitherMode = GLINT_READ_REG(DitherMode); + pRC->MX2.CFBSoftwareWriteMask = GLINT_READ_REG(FBSoftwareWriteMask); + pRC->MX2.CLogicalOpMode = GLINT_READ_REG(LogicalOpMode); + pRC->MX2.CFBWriteData = GLINT_READ_REG(FBWriteData); + pRC->MX2.CLBReadMode = GLINT_READ_REG(LBReadMode); + pRC->MX2.CLBSourceOffset = GLINT_READ_REG(LBSourceOffset); + pRC->MX2.CLBWindowBase = GLINT_READ_REG(LBWindowBase); + pRC->MX2.CLBWriteMode = GLINT_READ_REG(LBWriteMode); + pRC->MX2.CTextureDownloadOffset = GLINT_READ_REG(TextureDownloadOffset); + pRC->MX2.CLBWindowOffset = GLINT_READ_REG(LBWindowOffset); + pRC->MX2.CGLINTWindow = GLINT_READ_REG(GLINTWindow); + pRC->MX2.CStencilMode = GLINT_READ_REG(StencilMode); + pRC->MX2.CDepthMode = GLINT_READ_REG(DepthMode); + pRC->MX2.CGLINTDepth = GLINT_READ_REG(GLINTDepth); + pRC->MX2.CFBReadMode = GLINT_READ_REG(FBReadMode); + pRC->MX2.CFBSourceOffset = GLINT_READ_REG(FBSourceOffset); + pRC->MX2.CFBPixelOffset = GLINT_READ_REG(FBPixelOffset); + pRC->MX2.CFBWindowBase = GLINT_READ_REG(FBWindowBase); + pRC->MX2.CFBWriteMode = GLINT_READ_REG(FBWriteMode); + pRC->MX2.CFBHardwareWriteMask = GLINT_READ_REG(FBHardwareWriteMask); + pRC->MX2.CFBBlockColor = GLINT_READ_REG(FBBlockColor); + pRC->MX2.CPatternRamMode = GLINT_READ_REG(PatternRamMode); + pRC->MX2.CFBBlockColorU = GLINT_READ_REG(FBBlockColorU); + pRC->MX2.CFBBlockColorL = GLINT_READ_REG(FBBlockColorL); + pRC->MX2.CFilterMode = GLINT_READ_REG(FilterMode); + pRC->MX2.CStatisticMode = GLINT_READ_REG(StatisticMode); + ACCESSCHIP1(); } if (readContextType == DRI_3D_CONTEXT) { @@ -1020,133 +1024,135 @@ GLINTDRISwapContext( pRC->MX1.CKdBStart = GLINT_READ_REG(KdBStart); pRC->MX1.CdKdBdx = GLINT_READ_REG(dKdBdx); pRC->MX1.CdKdBdyDom = GLINT_READ_REG(dKdBdyDom); - if (pGlint->numMXDevices == 2) { - pRC->MX2.CSStart = GLINT_SECONDARY_READ_REG(SStart); - pRC->MX2.CdSdx = GLINT_SECONDARY_READ_REG(dSdx); - pRC->MX2.CdSdyDom = GLINT_SECONDARY_READ_REG(dSdyDom); - pRC->MX2.CTStart = GLINT_SECONDARY_READ_REG(TStart); - pRC->MX2.CdTdx = GLINT_SECONDARY_READ_REG(dTdx); - pRC->MX2.CdTdyDom = GLINT_SECONDARY_READ_REG(dTdyDom); - pRC->MX2.CQStart = GLINT_SECONDARY_READ_REG(QStart); - pRC->MX2.CdQdx = GLINT_SECONDARY_READ_REG(dQdx); - pRC->MX2.CdQdyDom = GLINT_SECONDARY_READ_REG(dQdyDom); - pRC->MX2.CLOD = GLINT_SECONDARY_READ_REG(LOD); - pRC->MX2.CdSdy = GLINT_SECONDARY_READ_REG(dSdy); - pRC->MX2.CdTdy = GLINT_SECONDARY_READ_REG(dTdy); - pRC->MX2.CdQdy = GLINT_SECONDARY_READ_REG(dQdy); - pRC->MX2.CTextureFormat = GLINT_SECONDARY_READ_REG(TextureFormat); - pRC->MX2.CTextureCacheControl = GLINT_SECONDARY_READ_REG(TextureCacheControl); - pRC->MX2.CGLINTBorderColor = GLINT_SECONDARY_READ_REG(GLINTBorderColor); - pRC->MX2.CTexelLUTIndex = GLINT_SECONDARY_READ_REG(TexelLUTIndex); - pRC->MX2.CTexelLUTData = GLINT_SECONDARY_READ_REG(TexelLUTData); - pRC->MX2.CTexelLUTAddress = GLINT_SECONDARY_READ_REG(TexelLUTAddress); - pRC->MX2.CTexelLUTTransfer = GLINT_SECONDARY_READ_REG(TexelLUTTransfer); - pRC->MX2.CTextureFilterMode = GLINT_SECONDARY_READ_REG(TextureFilterMode); - pRC->MX2.CTextureChromaUpper = GLINT_SECONDARY_READ_REG(TextureChromaUpper); - pRC->MX2.CTextureChromaLower = GLINT_SECONDARY_READ_REG(TextureChromaLower); - pRC->MX2.CTxBaseAddr0 = GLINT_SECONDARY_READ_REG(TxBaseAddr0); - pRC->MX2.CTxBaseAddr1 = GLINT_SECONDARY_READ_REG(TxBaseAddr1); - pRC->MX2.CTxBaseAddr2 = GLINT_SECONDARY_READ_REG(TxBaseAddr2); - pRC->MX2.CTxBaseAddr3 = GLINT_SECONDARY_READ_REG(TxBaseAddr3); - pRC->MX2.CTxBaseAddr4 = GLINT_SECONDARY_READ_REG(TxBaseAddr4); - pRC->MX2.CTxBaseAddr5 = GLINT_SECONDARY_READ_REG(TxBaseAddr5); - pRC->MX2.CTxBaseAddr6 = GLINT_SECONDARY_READ_REG(TxBaseAddr6); - pRC->MX2.CTxBaseAddr7 = GLINT_SECONDARY_READ_REG(TxBaseAddr7); - pRC->MX2.CTxBaseAddr8 = GLINT_SECONDARY_READ_REG(TxBaseAddr8); - pRC->MX2.CTxBaseAddr9 = GLINT_SECONDARY_READ_REG(TxBaseAddr9); - pRC->MX2.CTxBaseAddr10 = GLINT_SECONDARY_READ_REG(TxBaseAddr10); - pRC->MX2.CTxBaseAddr11 = GLINT_SECONDARY_READ_REG(TxBaseAddr11); - pRC->MX2.CTexelLUT0 = GLINT_SECONDARY_READ_REG(TexelLUT0); - pRC->MX2.CTexelLUT1 = GLINT_SECONDARY_READ_REG(TexelLUT1); - pRC->MX2.CTexelLUT2 = GLINT_SECONDARY_READ_REG(TexelLUT2); - pRC->MX2.CTexelLUT3 = GLINT_SECONDARY_READ_REG(TexelLUT3); - pRC->MX2.CTexelLUT4 = GLINT_SECONDARY_READ_REG(TexelLUT4); - pRC->MX2.CTexelLUT5 = GLINT_SECONDARY_READ_REG(TexelLUT5); - pRC->MX2.CTexelLUT6 = GLINT_SECONDARY_READ_REG(TexelLUT6); - pRC->MX2.CTexelLUT7 = GLINT_SECONDARY_READ_REG(TexelLUT7); - pRC->MX2.CTexelLUT8 = GLINT_SECONDARY_READ_REG(TexelLUT8); - pRC->MX2.CTexelLUT9 = GLINT_SECONDARY_READ_REG(TexelLUT9); - pRC->MX2.CTexelLUT10 = GLINT_SECONDARY_READ_REG(TexelLUT10); - pRC->MX2.CTexelLUT11 = GLINT_SECONDARY_READ_REG(TexelLUT11); - pRC->MX2.CTexelLUT12 = GLINT_SECONDARY_READ_REG(TexelLUT12); - pRC->MX2.CTexelLUT13 = GLINT_SECONDARY_READ_REG(TexelLUT13); - pRC->MX2.CTexelLUT14 = GLINT_SECONDARY_READ_REG(TexelLUT14); - pRC->MX2.CTexelLUT15 = GLINT_SECONDARY_READ_REG(TexelLUT15); - pRC->MX2.CTexel0 = GLINT_SECONDARY_READ_REG(Texel0); - pRC->MX2.CTexel1 = GLINT_SECONDARY_READ_REG(Texel1); - pRC->MX2.CTexel2 = GLINT_SECONDARY_READ_REG(Texel2); - pRC->MX2.CTexel3 = GLINT_SECONDARY_READ_REG(Texel3); - pRC->MX2.CTexel4 = GLINT_SECONDARY_READ_REG(Texel4); - pRC->MX2.CTexel5 = GLINT_SECONDARY_READ_REG(Texel5); - pRC->MX2.CTexel6 = GLINT_SECONDARY_READ_REG(Texel6); - pRC->MX2.CTexel7 = GLINT_SECONDARY_READ_REG(Texel7); - pRC->MX2.CInterp0 = GLINT_SECONDARY_READ_REG(Interp0); - pRC->MX2.CInterp1 = GLINT_SECONDARY_READ_REG(Interp1); - pRC->MX2.CInterp2 = GLINT_SECONDARY_READ_REG(Interp2); - pRC->MX2.CInterp3 = GLINT_SECONDARY_READ_REG(Interp3); - pRC->MX2.CInterp4 = GLINT_SECONDARY_READ_REG(Interp4); - pRC->MX2.CTextureFilter = GLINT_SECONDARY_READ_REG(TextureFilter); - pRC->MX2.CTextureEnvColor = GLINT_SECONDARY_READ_REG(TextureEnvColor); - pRC->MX2.CFogColor = GLINT_SECONDARY_READ_REG(FogColor); - pRC->MX2.CFStart = GLINT_SECONDARY_READ_REG(FStart); - pRC->MX2.CdFdx = GLINT_SECONDARY_READ_REG(dFdx); - pRC->MX2.CdFdyDom = GLINT_SECONDARY_READ_REG(dFdyDom); - pRC->MX2.CKsStart = GLINT_SECONDARY_READ_REG(KsStart); - pRC->MX2.CdKsdx = GLINT_SECONDARY_READ_REG(dKsdx); - pRC->MX2.CdKsdyDom = GLINT_SECONDARY_READ_REG(dKsdyDom); - pRC->MX2.CKdStart = GLINT_SECONDARY_READ_REG(KdStart); - pRC->MX2.CdKdStart = GLINT_SECONDARY_READ_REG(dKdStart); - pRC->MX2.CdKddyDom = GLINT_SECONDARY_READ_REG(dKddyDom); - pRC->MX2.CRStart = GLINT_SECONDARY_READ_REG(RStart); - pRC->MX2.CdRdx = GLINT_SECONDARY_READ_REG(dRdx); - pRC->MX2.CdRdyDom = GLINT_SECONDARY_READ_REG(dRdyDom); - pRC->MX2.CGStart = GLINT_SECONDARY_READ_REG(GStart); - pRC->MX2.CdGdx = GLINT_SECONDARY_READ_REG(dGdx); - pRC->MX2.CdGdyDom = GLINT_SECONDARY_READ_REG(dGdyDom); - pRC->MX2.CBStart = GLINT_SECONDARY_READ_REG(BStart); - pRC->MX2.CdBdx = GLINT_SECONDARY_READ_REG(dBdx); - pRC->MX2.CdBdyDom = GLINT_SECONDARY_READ_REG(dBdyDom); - pRC->MX2.CAStart = GLINT_SECONDARY_READ_REG(AStart); - pRC->MX2.CdAdx = GLINT_SECONDARY_READ_REG(dAdx); - pRC->MX2.CdAdyDom = GLINT_SECONDARY_READ_REG(dAdyDom); - pRC->MX2.CConstantColor = GLINT_SECONDARY_READ_REG(ConstantColor); - pRC->MX2.CChromaUpper = GLINT_SECONDARY_READ_REG(ChromaUpper); - pRC->MX2.CChromaLower = GLINT_SECONDARY_READ_REG(ChromaLower); - pRC->MX2.CChromaTestMode = GLINT_SECONDARY_READ_REG(ChromaTestMode); - pRC->MX2.CStencilData = GLINT_SECONDARY_READ_REG(StencilData); - pRC->MX2.CGLINTStencil = GLINT_SECONDARY_READ_REG(GLINTStencil); - pRC->MX2.CZStartU = GLINT_SECONDARY_READ_REG(ZStartU); - pRC->MX2.CZStartL = GLINT_SECONDARY_READ_REG(ZStartL); - pRC->MX2.CdZdxU = GLINT_SECONDARY_READ_REG(dZdxU); - pRC->MX2.CdZdxL = GLINT_SECONDARY_READ_REG(dZdxL); - pRC->MX2.CdZdyDomU = GLINT_SECONDARY_READ_REG(dZdyDomU); - pRC->MX2.CdZdyDomL = GLINT_SECONDARY_READ_REG(dZdyDomL); - pRC->MX2.CFastClearDepth = GLINT_SECONDARY_READ_REG(FastClearDepth); - pRC->MX2.CMinRegion = GLINT_SECONDARY_READ_REG(MinRegion); - pRC->MX2.CMaxRegion = GLINT_SECONDARY_READ_REG(MaxRegion); - pRC->MX2.CKsRStart = GLINT_SECONDARY_READ_REG(KsRStart); - pRC->MX2.CdKsRdx = GLINT_SECONDARY_READ_REG(dKsRdx); - pRC->MX2.CdKsRdyDom = GLINT_SECONDARY_READ_REG(dKsRdyDom); - pRC->MX2.CKsGStart = GLINT_SECONDARY_READ_REG(KsGStart); - pRC->MX2.CdKsGdx = GLINT_SECONDARY_READ_REG(dKsGdx); - pRC->MX2.CdKsGdyDom = GLINT_SECONDARY_READ_REG(dKsGdyDom); - pRC->MX2.CKsBStart = GLINT_SECONDARY_READ_REG(KsBStart); - pRC->MX2.CdKsBdx = GLINT_SECONDARY_READ_REG(dKsBdx); - pRC->MX2.CdKsBdyDom = GLINT_SECONDARY_READ_REG(dKsBdyDom); - pRC->MX2.CKdRStart = GLINT_SECONDARY_READ_REG(KdRStart); - pRC->MX2.CdKdRdx = GLINT_SECONDARY_READ_REG(dKdRdx); - pRC->MX2.CdKdRdyDom = GLINT_SECONDARY_READ_REG(dKdRdyDom); - pRC->MX2.CKdGStart = GLINT_SECONDARY_READ_REG(KdGStart); - pRC->MX2.CdKdGdx = GLINT_SECONDARY_READ_REG(dKdGdx); - pRC->MX2.CdKdGdyDom = GLINT_SECONDARY_READ_REG(dKdGdyDom); - pRC->MX2.CKdBStart = GLINT_SECONDARY_READ_REG(KdBStart); - pRC->MX2.CdKdBdx = GLINT_SECONDARY_READ_REG(dKdBdx); - pRC->MX2.CdKdBdyDom = GLINT_SECONDARY_READ_REG(dKdBdyDom); + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + pRC->MX2.CSStart = GLINT_READ_REG(SStart); + pRC->MX2.CdSdx = GLINT_READ_REG(dSdx); + pRC->MX2.CdSdyDom = GLINT_READ_REG(dSdyDom); + pRC->MX2.CTStart = GLINT_READ_REG(TStart); + pRC->MX2.CdTdx = GLINT_READ_REG(dTdx); + pRC->MX2.CdTdyDom = GLINT_READ_REG(dTdyDom); + pRC->MX2.CQStart = GLINT_READ_REG(QStart); + pRC->MX2.CdQdx = GLINT_READ_REG(dQdx); + pRC->MX2.CdQdyDom = GLINT_READ_REG(dQdyDom); + pRC->MX2.CLOD = GLINT_READ_REG(LOD); + pRC->MX2.CdSdy = GLINT_READ_REG(dSdy); + pRC->MX2.CdTdy = GLINT_READ_REG(dTdy); + pRC->MX2.CdQdy = GLINT_READ_REG(dQdy); + pRC->MX2.CTextureFormat = GLINT_READ_REG(TextureFormat); + pRC->MX2.CTextureCacheControl = GLINT_READ_REG(TextureCacheControl); + pRC->MX2.CGLINTBorderColor = GLINT_READ_REG(GLINTBorderColor); + pRC->MX2.CTexelLUTIndex = GLINT_READ_REG(TexelLUTIndex); + pRC->MX2.CTexelLUTData = GLINT_READ_REG(TexelLUTData); + pRC->MX2.CTexelLUTAddress = GLINT_READ_REG(TexelLUTAddress); + pRC->MX2.CTexelLUTTransfer = GLINT_READ_REG(TexelLUTTransfer); + pRC->MX2.CTextureFilterMode = GLINT_READ_REG(TextureFilterMode); + pRC->MX2.CTextureChromaUpper = GLINT_READ_REG(TextureChromaUpper); + pRC->MX2.CTextureChromaLower = GLINT_READ_REG(TextureChromaLower); + pRC->MX2.CTxBaseAddr0 = GLINT_READ_REG(TxBaseAddr0); + pRC->MX2.CTxBaseAddr1 = GLINT_READ_REG(TxBaseAddr1); + pRC->MX2.CTxBaseAddr2 = GLINT_READ_REG(TxBaseAddr2); + pRC->MX2.CTxBaseAddr3 = GLINT_READ_REG(TxBaseAddr3); + pRC->MX2.CTxBaseAddr4 = GLINT_READ_REG(TxBaseAddr4); + pRC->MX2.CTxBaseAddr5 = GLINT_READ_REG(TxBaseAddr5); + pRC->MX2.CTxBaseAddr6 = GLINT_READ_REG(TxBaseAddr6); + pRC->MX2.CTxBaseAddr7 = GLINT_READ_REG(TxBaseAddr7); + pRC->MX2.CTxBaseAddr8 = GLINT_READ_REG(TxBaseAddr8); + pRC->MX2.CTxBaseAddr9 = GLINT_READ_REG(TxBaseAddr9); + pRC->MX2.CTxBaseAddr10 = GLINT_READ_REG(TxBaseAddr10); + pRC->MX2.CTxBaseAddr11 = GLINT_READ_REG(TxBaseAddr11); + pRC->MX2.CTexelLUT0 = GLINT_READ_REG(TexelLUT0); + pRC->MX2.CTexelLUT1 = GLINT_READ_REG(TexelLUT1); + pRC->MX2.CTexelLUT2 = GLINT_READ_REG(TexelLUT2); + pRC->MX2.CTexelLUT3 = GLINT_READ_REG(TexelLUT3); + pRC->MX2.CTexelLUT4 = GLINT_READ_REG(TexelLUT4); + pRC->MX2.CTexelLUT5 = GLINT_READ_REG(TexelLUT5); + pRC->MX2.CTexelLUT6 = GLINT_READ_REG(TexelLUT6); + pRC->MX2.CTexelLUT7 = GLINT_READ_REG(TexelLUT7); + pRC->MX2.CTexelLUT8 = GLINT_READ_REG(TexelLUT8); + pRC->MX2.CTexelLUT9 = GLINT_READ_REG(TexelLUT9); + pRC->MX2.CTexelLUT10 = GLINT_READ_REG(TexelLUT10); + pRC->MX2.CTexelLUT11 = GLINT_READ_REG(TexelLUT11); + pRC->MX2.CTexelLUT12 = GLINT_READ_REG(TexelLUT12); + pRC->MX2.CTexelLUT13 = GLINT_READ_REG(TexelLUT13); + pRC->MX2.CTexelLUT14 = GLINT_READ_REG(TexelLUT14); + pRC->MX2.CTexelLUT15 = GLINT_READ_REG(TexelLUT15); + pRC->MX2.CTexel0 = GLINT_READ_REG(Texel0); + pRC->MX2.CTexel1 = GLINT_READ_REG(Texel1); + pRC->MX2.CTexel2 = GLINT_READ_REG(Texel2); + pRC->MX2.CTexel3 = GLINT_READ_REG(Texel3); + pRC->MX2.CTexel4 = GLINT_READ_REG(Texel4); + pRC->MX2.CTexel5 = GLINT_READ_REG(Texel5); + pRC->MX2.CTexel6 = GLINT_READ_REG(Texel6); + pRC->MX2.CTexel7 = GLINT_READ_REG(Texel7); + pRC->MX2.CInterp0 = GLINT_READ_REG(Interp0); + pRC->MX2.CInterp1 = GLINT_READ_REG(Interp1); + pRC->MX2.CInterp2 = GLINT_READ_REG(Interp2); + pRC->MX2.CInterp3 = GLINT_READ_REG(Interp3); + pRC->MX2.CInterp4 = GLINT_READ_REG(Interp4); + pRC->MX2.CTextureFilter = GLINT_READ_REG(TextureFilter); + pRC->MX2.CTextureEnvColor = GLINT_READ_REG(TextureEnvColor); + pRC->MX2.CFogColor = GLINT_READ_REG(FogColor); + pRC->MX2.CFStart = GLINT_READ_REG(FStart); + pRC->MX2.CdFdx = GLINT_READ_REG(dFdx); + pRC->MX2.CdFdyDom = GLINT_READ_REG(dFdyDom); + pRC->MX2.CKsStart = GLINT_READ_REG(KsStart); + pRC->MX2.CdKsdx = GLINT_READ_REG(dKsdx); + pRC->MX2.CdKsdyDom = GLINT_READ_REG(dKsdyDom); + pRC->MX2.CKdStart = GLINT_READ_REG(KdStart); + pRC->MX2.CdKdStart = GLINT_READ_REG(dKdStart); + pRC->MX2.CdKddyDom = GLINT_READ_REG(dKddyDom); + pRC->MX2.CRStart = GLINT_READ_REG(RStart); + pRC->MX2.CdRdx = GLINT_READ_REG(dRdx); + pRC->MX2.CdRdyDom = GLINT_READ_REG(dRdyDom); + pRC->MX2.CGStart = GLINT_READ_REG(GStart); + pRC->MX2.CdGdx = GLINT_READ_REG(dGdx); + pRC->MX2.CdGdyDom = GLINT_READ_REG(dGdyDom); + pRC->MX2.CBStart = GLINT_READ_REG(BStart); + pRC->MX2.CdBdx = GLINT_READ_REG(dBdx); + pRC->MX2.CdBdyDom = GLINT_READ_REG(dBdyDom); + pRC->MX2.CAStart = GLINT_READ_REG(AStart); + pRC->MX2.CdAdx = GLINT_READ_REG(dAdx); + pRC->MX2.CdAdyDom = GLINT_READ_REG(dAdyDom); + pRC->MX2.CConstantColor = GLINT_READ_REG(ConstantColor); + pRC->MX2.CChromaUpper = GLINT_READ_REG(ChromaUpper); + pRC->MX2.CChromaLower = GLINT_READ_REG(ChromaLower); + pRC->MX2.CChromaTestMode = GLINT_READ_REG(ChromaTestMode); + pRC->MX2.CStencilData = GLINT_READ_REG(StencilData); + pRC->MX2.CGLINTStencil = GLINT_READ_REG(GLINTStencil); + pRC->MX2.CZStartU = GLINT_READ_REG(ZStartU); + pRC->MX2.CZStartL = GLINT_READ_REG(ZStartL); + pRC->MX2.CdZdxU = GLINT_READ_REG(dZdxU); + pRC->MX2.CdZdxL = GLINT_READ_REG(dZdxL); + pRC->MX2.CdZdyDomU = GLINT_READ_REG(dZdyDomU); + pRC->MX2.CdZdyDomL = GLINT_READ_REG(dZdyDomL); + pRC->MX2.CFastClearDepth = GLINT_READ_REG(FastClearDepth); + pRC->MX2.CMinRegion = GLINT_READ_REG(MinRegion); + pRC->MX2.CMaxRegion = GLINT_READ_REG(MaxRegion); + pRC->MX2.CKsRStart = GLINT_READ_REG(KsRStart); + pRC->MX2.CdKsRdx = GLINT_READ_REG(dKsRdx); + pRC->MX2.CdKsRdyDom = GLINT_READ_REG(dKsRdyDom); + pRC->MX2.CKsGStart = GLINT_READ_REG(KsGStart); + pRC->MX2.CdKsGdx = GLINT_READ_REG(dKsGdx); + pRC->MX2.CdKsGdyDom = GLINT_READ_REG(dKsGdyDom); + pRC->MX2.CKsBStart = GLINT_READ_REG(KsBStart); + pRC->MX2.CdKsBdx = GLINT_READ_REG(dKsBdx); + pRC->MX2.CdKsBdyDom = GLINT_READ_REG(dKsBdyDom); + pRC->MX2.CKdRStart = GLINT_READ_REG(KdRStart); + pRC->MX2.CdKdRdx = GLINT_READ_REG(dKdRdx); + pRC->MX2.CdKdRdyDom = GLINT_READ_REG(dKdRdyDom); + pRC->MX2.CKdGStart = GLINT_READ_REG(KdGStart); + pRC->MX2.CdKdGdx = GLINT_READ_REG(dKdGdx); + pRC->MX2.CdKdGdyDom = GLINT_READ_REG(dKdGdyDom); + pRC->MX2.CKdBStart = GLINT_READ_REG(KdBStart); + pRC->MX2.CdKdBdx = GLINT_READ_REG(dKdBdx); + pRC->MX2.CdKdBdyDom = GLINT_READ_REG(dKdBdyDom); + ACCESSCHIP1(); } /* send gamma the context dump command */ GLINT_WAIT(3); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_WRITE_REG(1, BroadcastMask); GLINT_WRITE_REG(3<<14, FilterMode); /* context bits on gamma */ GLINT_WRITE_REG(GLINT_GAMMA_CONTEXT_MASK, ContextDump); @@ -1179,7 +1185,7 @@ dumpIndex,readValue); readValue = GLINT_READ_REG(OutputFIFO); GLINT_SLOW_WRITE_REG(1<<10, FilterMode); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(3,BroadcastMask); } } @@ -1191,7 +1197,7 @@ dumpIndex,readValue); /* send context restore command */ GLINT_WAIT(1); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_WRITE_REG(1, BroadcastMask); GLINT_WAIT(3); @@ -1220,7 +1226,7 @@ dumpIndex,pWC->Gamma[dumpIndex]); pGlint->AccelInfoRec->NeedToSync = TRUE; /* finally the MX portions */ - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(1, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX1.CSStart, SStart); GLINT_SLOW_WRITE_REG(pWC->MX1.CdSdx, dSdx); @@ -1344,7 +1350,7 @@ dumpIndex,pWC->Gamma[dumpIndex]); GLINT_SLOW_WRITE_REG(pWC->MX1.CdKdBdx, dKdBdx); GLINT_SLOW_WRITE_REG(pWC->MX1.CdKdBdyDom, dKdBdyDom); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(2, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX2.CSStart, SStart); GLINT_SLOW_WRITE_REG(pWC->MX2.CdSdx, dSdx); @@ -1473,7 +1479,7 @@ dumpIndex,pWC->Gamma[dumpIndex]); /* restore the 2D portion of the new context */ /* Restore MX1's registers */ - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(1, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX1.CStartXDom, StartXDom); GLINT_SLOW_WRITE_REG(pWC->MX1.CdXDom, dXDom); @@ -1536,7 +1542,7 @@ dumpIndex,pWC->Gamma[dumpIndex]); GLINT_SLOW_WRITE_REG(pWC->MX1.CStatisticMode, StatisticMode); /* Restore MX2's registers */ - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(2, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX2.CStartXDom, StartXDom); GLINT_SLOW_WRITE_REG(pWC->MX2.CdXDom, dXDom); @@ -1629,7 +1635,7 @@ GLINTDRIInitBuffers( GLINT_WRITE_REG(0, FBWriteMode); GLINT_WRITE_REG(0, LBWindowBase); GLINT_WRITE_REG(1, LBWriteMode); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_WRITE_REG( pGlint->pprod | LBRM_ScanlineInt2 , LBReadMode); } else { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h index 9fe9f02de..08dc5e3b1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.4 2000/05/10 18:55:29 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.5 2001/01/31 16:14:55 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -50,7 +50,7 @@ typedef struct { drmMapFlags flagsControlRegs1; drmMapFlags flagsControlRegs2; drmMapFlags flagsControlRegs3; - int numMXDevices; + int numMultiDevices; int pprod; } GLINTDRIRec, *GLINTDRIPtr; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c index 344381c19..638c2298c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, * Siemens Nixdorf Informationssysteme and Appian Graphics. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.103 2000/12/08 13:42:35 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.117 2001/02/15 11:03:56 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -53,21 +53,18 @@ #include "mibstore.h" +#include "pm3_regs.h" #include "glint_regs.h" #include "IBM.h" #include "TI.h" #include "glint.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #define DEBUG 0 @@ -103,12 +100,13 @@ static Bool GLINTUnmapMem(ScrnInfoPtr pScrn); static void GLINTSave(ScrnInfoPtr pScrn); static void GLINTRestore(ScrnInfoPtr pScrn); static Bool GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void GLINTBlockHandler(int, pointer, pointer, pointer); /* * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. */ -static int pix24bpp = 0; +static int GLINTEntityIndex = -1; static Bool FBDevProbed = FALSE; /* @@ -122,9 +120,6 @@ static Bool FBDevProbed = FALSE; DriverRec GLINT = { VERSION, GLINT_DRIVER_NAME, -#if 0 - "accelerated driver for 3dlabs and derived chipsets", -#endif GLINTIdentify, GLINTProbe, GLINTAvailableOptions, @@ -132,6 +127,25 @@ DriverRec GLINT = { 0 }; +static SymTabRec GLINTVGAChipsets[] = { + { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, + { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, "pm" }, +}; + +static PciChipsets GLINTVGAPciChipsets[] = { + { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, + { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, PCI_VENDOR_3DLABS_CHIP_PERMEDIA, NULL }, + { -1, -1, RES_UNDEFINED } +}; + static SymTabRec GLINTChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, "gamma" }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, @@ -166,33 +180,23 @@ static PciChipsets GLINTPciChipsets[] = { { -1, -1, RES_UNDEFINED } }; - typedef enum { OPTION_SW_CURSOR, - OPTION_HW_CURSOR, - OPTION_PCI_RETRY, OPTION_RGB_BITS, OPTION_NOACCEL, OPTION_BLOCK_WRITE, OPTION_FIREGL3000, - OPTION_MEM_CLK, OPTION_OVERLAY, OPTION_SHADOW_FB, - OPTION_FBDEV, - OPTION_NOWRITEBITMAP, - OPTION_PM3_USE_GAMMA + OPTION_FBDEV } GLINTOpts; static OptionInfoRec GLINTOptions[] = { - { OPTION_PM3_USE_GAMMA, "UseGamma", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_RGB_BITS, "RGBbits", OPTV_INTEGER, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_BLOCK_WRITE, "BlockWrite", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FIREGL3000, "FireGL3000", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_MEM_CLK, "SetMClk", OPTV_FREQ, {0}, FALSE }, { OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, @@ -212,7 +216,6 @@ static RamDacSupportedInfoRec TIRamdacs[] = { { -1 } }; - static const char *vgahwSymbols[] = { "vgaHWGetIndex", "vgaHWSave", @@ -251,9 +254,7 @@ static const char *xaaSymbols[] = { static const char *fbSymbols[] = { "cfb8_32ScreenInit", -#ifdef RENDER "fbPictureInit", -#endif "fbScreenInit", "fbBres", NULL @@ -479,7 +480,6 @@ int partprodPermedia[] = { -1, -1, -1, -1, 0}; -#ifdef DPMSExtension static void GLINTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -490,7 +490,8 @@ GLINTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { vtgpolarity = GLINT_READ_REG(VTGPolarity) & 0xFFFFFFF0; } else { videocontrol = GLINT_READ_REG(PMVideoControl) & 0xFFFFFFD6; @@ -524,13 +525,13 @@ GLINTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { GLINT_SLOW_WRITE_REG(vtgpolarity, VTGPolarity); } else { GLINT_SLOW_WRITE_REG(videocontrol, PMVideoControl); } } -#endif static Bool GLINTGetRec(ScrnInfoPtr pScrn) @@ -686,9 +687,20 @@ GLINTProbe(DriverPtr drv, int flags) } else if (checkusedPci) { - numUsed = xf86MatchPciInstances(GLINT_NAME, 0, - GLINTChipsets, GLINTPciChipsets, devSections, - numDevSections, drv, &usedChips); + if (flags & PROBE_DETECT) { + /* HACK, Currently when -configuring, we only return VGA + * based chips. Manual configuring is necessary to poke + * at the other chips */ + numUsed = xf86MatchPciInstances(GLINT_NAME, 0, + GLINTVGAChipsets, GLINTVGAPciChipsets, + devSections, + numDevSections, drv, &usedChips); + } else { + numUsed = xf86MatchPciInstances(GLINT_NAME, 0, + GLINTChipsets, GLINTPciChipsets, devSections, + numDevSections, drv, &usedChips); + } + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -697,51 +709,111 @@ GLINTProbe(DriverPtr drv, int flags) if (!(flags & PROBE_DETECT)) for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; + GLINTEntPtr pGlintEnt = NULL; + DevUnion *pPriv; + pPci = xf86GetPciInfoForEntity(usedChips[i]); /* Allocate a ScrnInfoRec and claim the slot */ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], GLINTPciChipsets, NULL, NULL, NULL, NULL, NULL))) { - pPci = xf86GetPciInfoForEntity(usedChips[i]); - /* Only claim other chips when GAMMA is used */ - if (pPci->chipType == PCI_CHIP_GAMMA) { - while (*checkusedPci != NULL) { - int eIndex; + /* Claim specifics, when we KNOW ! the board */ + + /* Appian Jeronimo J2000 */ + if ((pPci->subsysVendor == 0x1097) && + (pPci->subsysCard == 0x3d32)) { + int eIndex; + if (!xf86IsEntityShared(usedChips[i])) { + eIndex = xf86ClaimPciSlot(pPci->bus, + pPci->device, + 1, + drv, -1 /* XXX */, + NULL, FALSE); + xf86AddEntityToScreen(pScrn,eIndex); + } else { + eIndex = xf86ClaimPciSlot(pPci->bus, + pPci->device, + 2, + drv, -1 /* XXX */, + NULL, FALSE); + xf86AddEntityToScreen(pScrn,eIndex); + } + } else + /* Only claim other chips when GAMMA is used */ + if (pPci->chipType == PCI_CHIP_GAMMA) { + while (*checkusedPci != NULL) { + int eIndex; /* make sure we claim all but our source device */ - if ((pPci->bus == (*checkusedPci)->bus && - pPci->device == (*checkusedPci)->device) && + if ((pPci->bus == (*checkusedPci)->bus && + pPci->device == (*checkusedPci)->device) && pPci->func != (*checkusedPci)->func) { - - /* Claim other entities on the same card */ - eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, + + /* Claim other entities on the same card */ + eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, (*checkusedPci)->device, (*checkusedPci)->func, drv, -1 /* XXX */, NULL, FALSE); - if (eIndex == -1) { - /* This can't happen */ - FatalError("someone claimed the free slot!\n"); - } - xf86AddEntityToScreen(pScrn,eIndex); - } - checkusedPci++; - } - } - /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = VERSION; - pScrn->driverName = GLINT_DRIVER_NAME; - pScrn->name = GLINT_NAME; - pScrn->Probe = GLINTProbe; - pScrn->PreInit = GLINTPreInit; - pScrn->ScreenInit = GLINTScreenInit; - pScrn->SwitchMode = GLINTSwitchMode; - pScrn->FreeScreen = GLINTFreeScreen; - pScrn->EnterVT = GLINTEnterVT; + if (eIndex != -1) { + xf86AddEntityToScreen(pScrn,eIndex); + } else { + ErrorF("BusID %d:%d:%d already claimed\n", + (*checkusedPci)->bus, + (*checkusedPci)->device, + (*checkusedPci)->func); + xfree(usedChips); + return FALSE; + } + } + checkusedPci++; + } } - } + + /* Fill in what we can of the ScrnInfoRec */ + pScrn->driverVersion = VERSION; + pScrn->driverName = GLINT_DRIVER_NAME; + pScrn->name = GLINT_NAME; + pScrn->Probe = GLINTProbe; + pScrn->PreInit = GLINTPreInit; + pScrn->ScreenInit = GLINTScreenInit; + pScrn->SwitchMode = GLINTSwitchMode; + pScrn->FreeScreen = GLINTFreeScreen; + pScrn->EnterVT = GLINTEnterVT; + } + + /* Allow sharing if Appian J2000 detected */ + /* (later Diamond FireGL3000 support too) */ + + if ((pPci->subsysVendor == 0x1097) && + (pPci->subsysCard == 0x3d32)) { + xf86SetEntitySharable(usedChips[i]); + /* Allocate an entity private if necessary */ + if (GLINTEntityIndex < 0) + GLINTEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + GLINTEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(GLINTEntRec), 1); + pGlintEnt = pPriv->ptr; + pGlintEnt->lastInstance = -1; + } else { + pGlintEnt = pPriv->ptr; + } + + /* + * Set the entity instance for this instance of the driver. + * For dual head per card, instance 0 is the "master" + * instance, driving the primary head, and instance 1 is + * the "slave". + */ + pGlintEnt->lastInstance++; + xf86SetEntityInstanceForScreen(pScrn, + pScrn->entityList[0], pGlintEnt->lastInstance); + } + } } xfree(usedChips); @@ -767,7 +839,6 @@ GetAccelPitchValues(ScrnInfoPtr pScrn) switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_TI_CHIP_PERMEDIA: - case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: @@ -776,9 +847,18 @@ GetAccelPitchValues(ScrnInfoPtr pScrn) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: linep = &partprod500TX[0]; break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + /* When GAMMA in use, we always have MultiChip defined, even if + * only one chip is connected to GAMMA as the entites > 1 + */ + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + linep = &partprod500TX[0]; + break; + } + break; } for (i = 0; linep[i] != 0; i++) { @@ -806,21 +886,12 @@ GLINTProbeTIramdac(ScrnInfoPtr pScrn) pGlint = GLINTPTR(pScrn); pGlint->RamDacRec = RamDacCreateInfoRec(); - if (pGlint->numMXDevices == 2) { - pGlint->RamDacRec->ReadDAC = DUALglintInTIIndReg; - pGlint->RamDacRec->WriteDAC = DUALglintOutTIIndReg; - pGlint->RamDacRec->ReadAddress = DUALglintTIReadAddress; - pGlint->RamDacRec->WriteAddress = DUALglintTIWriteAddress; - pGlint->RamDacRec->ReadData = DUALglintTIReadData; - pGlint->RamDacRec->WriteData = DUALglintTIWriteData; - } else { - pGlint->RamDacRec->ReadDAC = glintInTIIndReg; - pGlint->RamDacRec->WriteDAC = glintOutTIIndReg; - pGlint->RamDacRec->ReadAddress = glintTIReadAddress; - pGlint->RamDacRec->WriteAddress = glintTIWriteAddress; - pGlint->RamDacRec->ReadData = glintTIReadData; - pGlint->RamDacRec->WriteData = glintTIWriteData; - } + pGlint->RamDacRec->ReadDAC = glintInTIIndReg; + pGlint->RamDacRec->WriteDAC = glintOutTIIndReg; + pGlint->RamDacRec->ReadAddress = glintTIReadAddress; + pGlint->RamDacRec->WriteAddress = glintTIWriteAddress; + pGlint->RamDacRec->ReadData = glintTIReadData; + pGlint->RamDacRec->WriteData = glintTIWriteData; pGlint->RamDacRec->LoadPalette = TIramdacLoadPalette; if(!RamDacInit(pScrn, pGlint->RamDacRec)) { @@ -828,12 +899,12 @@ GLINTProbeTIramdac(ScrnInfoPtr pScrn) return; } GLINTMapMem(pScrn); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { temp = GLINT_READ_REG(GCSRAperture); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); } pGlint->RamDac = TIramdacProbe(pScrn, TIRamdacs); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(temp, GCSRAperture); } GLINTUnmapMem(pScrn); @@ -866,10 +937,9 @@ static Bool GLINTPreInit(ScrnInfoPtr pScrn, int flags) { GLINTPtr pGlint; + GLINTEntPtr pGlintEnt = NULL; MessageType from; int i; - int LinearFramebuffer = 0; - double real; Bool Overlay = FALSE; int maxwidth = 0, maxheight = 0; ClockRangePtr clockRanges; @@ -904,28 +974,23 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* Get the entities, and make sure they are PCI. */ pGlint->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - if (flags & PROBE_DETECT) { - GLINTProbeDDC(pScrn, pGlint->pEnt->index); - return TRUE; + /* Allocate an entity private if necessary */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + pGlintEnt = xf86GetEntityPrivate(pScrn->entityList[0], + GLINTEntityIndex)->ptr; + pGlint->entityPrivate = pGlintEnt; } if (pGlint->pEnt->location.type == BUS_PCI) { - /* Initialize the card through int10 interface if needed */ - if ( xf86LoadSubModule(pScrn, "int10")){ - xf86Int10InfoPtr pInt; - - xf86LoaderReqSymLists(int10Symbols, NULL); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); - pInt = xf86InitInt10(pGlint->pEnt->index); - xf86FreeInt10(pInt); - } - pGlint->PciInfo = xf86GetPciInfoForEntity(pGlint->pEnt->index); pGlint->PciTag = pciTag(pGlint->PciInfo->bus, pGlint->PciInfo->device, pGlint->PciInfo->func); } + pGlint->numMultiDevices = 0; + pGlint->IOOffset = 0; /* Set IO Offset for Gamma */ + if (pScrn->numEntities > 1) { pciVideoPtr pPci; EntityInfoPtr pEnt; @@ -933,29 +998,41 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) for (i = 1; i < pScrn->numEntities; i++) { pEnt = xf86GetEntityInfo(pScrn->entityList[i]); pPci = xf86GetPciInfoForEntity(pEnt->index); - if (pPci->chipType == PCI_CHIP_MX) { - if (pGlint->numMXDevices >= GLINT_MAX_MX_DEVICES) { + if ( (pPci->chipType == PCI_CHIP_MX) || + (pPci->chipType == PCI_CHIP_PERMEDIA3) ) { + pGlint->MultiChip = pPci->chipType; + if (pGlint->numMultiDevices >= GLINT_MAX_MULTI_DEVICES) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "%d MX chips unsupported, aborting. (Max - 2)\n", - pGlint->numMXDevices); + "%d multiple chips unsupported, aborting. (Max - 2)\n", + pGlint->numMultiDevices); return FALSE; } else { - LinearFramebuffer = pPci->memBase[2]; - pGlint->MXPciInfo[pGlint->numMXDevices] = pPci; - pGlint->numMXDevices++; + pGlint->MultiPciInfo[pGlint->numMultiDevices] = pPci; + pGlint->numMultiDevices++; } } } } - /* - * VGA isn't used, so mark it so. XXX Should check if any VGA resources - * are decoded or not, and if not, change them from Unused to Disabled. - * Mem resources seem to be disabled. This is importand to avoid conflicts - * with DGA - */ + { + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); + + if ( (pPci->chipType == PCI_CHIP_GAMMA) && + (pGlint->numMultiDevices == 0) ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Gamma with ZERO connected chips, aborting\n"); + return FALSE; + } + } + + if (flags & PROBE_DETECT) { + GLINTProbeDDC(pScrn, pGlint->pEnt->index); + return TRUE; + } + xf86SetOperatingState(resVgaMemShared, pGlint->pEnt->index, ResDisableOpr); - xf86SetOperatingState(resVgaIoShared, pGlint->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaIoShared, pGlint->pEnt->index, ResDisableOpr); /* Operations for which memory access is required. */ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; @@ -1002,10 +1079,6 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) xf86PrintDepthBpp(pScrn); - /* Get the depth24 pixmap format */ - if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); - /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. @@ -1058,22 +1131,14 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* Default to 8bits per RGB */ if (pScrn->depth == 30) pScrn->rgbBits = 10; - else pScrn->rgbBits = 8; + else pScrn->rgbBits = 8; if (xf86GetOptValInteger(GLINTOptions, OPTION_RGB_BITS, &pScrn->rgbBits)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Bits per RGB set to %d\n", pScrn->rgbBits); } - if (xf86GetOptValFreq(GLINTOptions, OPTION_MEM_CLK, OPTUNITS_MHZ, &real)) { - pGlint->MemClock = (int)real; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Memory Clock override enabled, set to %dMHz\n", - pGlint->MemClock); - } from = X_DEFAULT; pGlint->HWCursor = TRUE; /* ON by default */ - if (xf86GetOptValBool(GLINTOptions, OPTION_HW_CURSOR, &pGlint->HWCursor)) - from = X_CONFIG; if (xf86ReturnOptValBool(GLINTOptions, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pGlint->HWCursor = FALSE; @@ -1127,12 +1192,6 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "%s Linux framebuffer device\n", pGlint->FBDev ? "Using" : "Not using"); - pGlint->UsePCIRetry = FALSE; - from = X_DEFAULT; - if (xf86GetOptValBool(GLINTOptions, OPTION_PCI_RETRY, &pGlint->UsePCIRetry)) - from = X_CONFIG; - if (pGlint->UsePCIRetry) - xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry enabled\n"); pScrn->overlayFlags = 0; from = X_DEFAULT; if ((s = xf86GetOptValString(GLINTOptions, OPTION_OVERLAY))) { @@ -1154,6 +1213,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->VGAcore = FALSE; pGlint->DoubleBuffer = FALSE; pGlint->RamDac = NULL; + pGlint->STATE = FALSE; /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -1208,59 +1268,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - /* SVEN : Claim a Gamma chip if available. */ - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - int eIndex = -1; - from = X_DEFAULT; - pGlint->PM3_UseGamma = FALSE; - if (xf86ReturnOptValBool(GLINTOptions, OPTION_PM3_USE_GAMMA, FALSE)) { - from = X_CONFIG; - pGlint->PM3_UseGamma = TRUE; - } - xf86DrvMsg(pScrn->scrnIndex, from, "%s to use Gamma with Permedia 3.\n", - (pGlint->PM3_UseGamma ? "Trying" : "Not trying")); - if (pGlint->PM3_UseGamma) { - pciVideoPtr *checkusedPci; - checkusedPci = xf86GetPciVideoInfo(); - while (*checkusedPci != NULL) { - /* Is there a free gamma on the same device ? */ - if (((*checkusedPci)->chipType == PCI_CHIP_GAMMA) && - (((*checkusedPci)->bus == pGlint->PciInfo->bus)) && - (((*checkusedPci)->device == pGlint->PciInfo->device))) - if ((eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, - (*checkusedPci)->device, - (*checkusedPci)->func, - pScrn->drv, -1, - NULL, FALSE)) != -1) break; - } - checkusedPci++; - } - if (eIndex == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "No free Gamma chip was found.\n"); - pGlint->PM3_UseGamma = FALSE; - } else { - unsigned int r; - /* Add the Gamma to the screen info structure. */ - xf86AddEntityToScreen(pScrn,eIndex); - pGlint->PM3_GammaPciInfo = - xf86GetPciInfoForEntity(eIndex); - pGlint->PM3_GammaPciTag = pciTag( - pGlint->PM3_GammaPciInfo->bus, - pGlint->PM3_GammaPciInfo->device, - pGlint->PM3_GammaPciInfo->func); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Gamma Claimed at BusID PCI:%d:%d:%d.\n", - pGlint->PM3_GammaPciInfo->bus, - pGlint->PM3_GammaPciInfo->device, - pGlint->PM3_GammaPciInfo->func); - /* Let's dump the Gamma registers, at least some of them ... */ - pGlint->PM3_GammaIOAddress = - pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000; - } - } if ((pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2)) { if (xf86ReturnOptValBool(GLINTOptions, OPTION_BLOCK_WRITE, FALSE)) { @@ -1290,17 +1298,18 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->FbAddress = pGlint->PciInfo->memBase[2] & 0xFF800000; } - xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", + if (pGlint->FbAddress) + xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pGlint->FbAddress); /* Trap GAMMA & DELTA specification, with no linear address */ - /* Find the first SX/TX/MX chip and use that address */ + /* Find the first GLINT chip and use that address */ if (pGlint->FbAddress == 0) { - if (LinearFramebuffer) { - pGlint->FbAddress = LinearFramebuffer; + if (pGlint->MultiPciInfo[0]->memBase[2]) { + pGlint->FbAddress = pGlint->MultiPciInfo[0]->memBase[2]; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "FrameBuffer used from first SX/TX/MX chip at 0x%x\n", - LinearFramebuffer); + "FrameBuffer used from first rasterizer chip at 0x%x\n", + pGlint->MultiPciInfo[0]->memBase[2]); } else { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No FrameBuffer memory - aborting\n"); @@ -1315,11 +1324,6 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) */ pGlint->IOAddress = pGlint->pEnt->device->IOBase; from = X_CONFIG; -#if 0 /* This freezes the box, why ? */ - } else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) && - pGlint->PM3_UseGamma) { - pGlint->IOAddress = pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000; -#endif } else { pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000; } @@ -1327,6 +1331,21 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->IOAddress += 0x10000; #endif + if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + /* Fix up for dual head mode, offset gamma registers at 0x10000 */ + if ((xf86IsEntityShared(pScrn->entityList[0])) && + (xf86IsPrimInitDone(pScrn->entityList[0]))) { +#if 0 /* When we need gamma & acceleration, this should be used instead */ + pGlint->IOAddress += 0x10000; +#endif + } else { + xf86SetPrimInitDone(pScrn->entityList[0]); + } +#if 1 /* And then remove this */ + pGlint->IOAddress = pGlint->MultiPciInfo[0]->memBase[0] & 0xFFFFC000; +#endif + } + xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pGlint->IOAddress); @@ -1344,6 +1363,31 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } } + pGlint->FbMapSize = 0; + + { + /* We have to boot some multiple head type boards here */ + GLINTMapMem(pScrn); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + Permedia3PreInit(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + Permedia2VPreInit(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + Permedia3PreInit(pScrn); + break; + } + break; + default: + break; + } + GLINTUnmapMem(pScrn); + } + /* HW bpp matches reported bpp */ pGlint->HwBpp = pScrn->bitsPerPixel; @@ -1352,32 +1396,47 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if (pGlint->pEnt->device->videoRam != 0) { pScrn->videoRam = pGlint->pEnt->device->videoRam; from = X_CONFIG; - } else if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - /* Need to initialize the memory timings of the second head - * of the Appian Jeronimo 2000 board here. - * Check this routine in pm3_dac.c if you have another board - * than a J2000, as memory timings will surely change. - */ - GLINTMapMem(pScrn); - Permedia3PreInit(pScrn); - GLINTUnmapMem(pScrn); - pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); - } else if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) { - /* The PM2v has the same problem detecting memory as the PM3 */ - pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); } else { - pGlint->FbMapSize = 0; /* Need to set FbMapSize for MMIO access */ /* Need to access MMIO to determine videoRam */ GLINTMapMem(pScrn); - if( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) ) - pScrn->videoRam = 1024 * (1 << ((GLINT_READ_REG(FBMemoryCtl) & - 0xE0000000)>>29)); - else - pScrn->videoRam = 2048 * (((GLINT_READ_REG(PMMemConfig) >> 29) & - 0x03) + 1); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_500TX: + case PCI_VENDOR_3DLABS_CHIP_300SX: + case PCI_VENDOR_3DLABS_CHIP_MX: + pScrn->videoRam = (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig) >> 29) & + 0x03) + 1) * 2048; + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is GLINT MX\n"); + pScrn->videoRam = + (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_CHIP_PERMEDIA3: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is Permedia3\n"); + pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); + break; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Number of Rasterizers attached is %d\n", + pGlint->numMultiDevices); + break; + } GLINTUnmapMem(pScrn); } } else { @@ -1386,61 +1445,19 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->FbMapSize = pScrn->videoRam * 1024; - /* We should move this out somewhere ! */ + /* OVERRIDE videoRam/FbMapSize, for Multiply connected chips to GAMMA */ + pGlint->MultiAperture = FALSE; if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { + (pGlint->numMultiDevices == 2) ) { CARD32 chipconfig; + CARD32 size = 0; CARD32 temp; GLINTMapMem(pScrn); -#if 0 - /* We shouldn't really do this yet, we haven't saved the - * state of the chip. - * Best of all put a timer in to reset the engine if it - * doesn't respond - but later */ - /* - * This is needed before the first GLINT_SLOW_WRITE_REG -- - * otherwise the server will hang if it was left in a bad state. - */ - GLINT_WRITE_REG(0, ResetStatus); - while (GLINT_READ_REG(ResetStatus) & 0x80000000) { - xf86DrvMsg(pScrn->scrnIndex, from, "Resetting Core\n"); - } -#endif - temp = GLINT_READ_REG(GCSRAperture); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); -#if 0 - xf86DrvMsg(pScrn->scrnIndex, from, - "InFIFOSpace = %d, %d (after reset)\n", - GLINT_READ_REG(InFIFOSpace), - GLINT_SECONDARY_READ_REG(InFIFOSpace)); - xf86DrvMsg(pScrn->scrnIndex, from, - "OutFIFOSWords = %d, %d (after reset)\n", - GLINT_READ_REG(OutFIFOWords), - GLINT_SECONDARY_READ_REG(OutFIFOWords)); - - /* Reset doesn't appear to drain the Output - FIFO. Argh. */ - while (GLINT_READ_REG(OutFIFOWords)) { - GLINT_READ_REG(OutputFIFO); - } - while (GLINT_SECONDARY_READ_REG(OutFIFOWords)) { - GLINT_SECONDARY_READ_REG(OutputFIFO); - } - - xf86DrvMsg(pScrn->scrnIndex, from, - "InFIFOSpace = %d, %d (after drain)\n", - GLINT_READ_REG(InFIFOSpace), - GLINT_SECONDARY_READ_REG(InFIFOSpace)); - xf86DrvMsg(pScrn->scrnIndex, from, - "OutFIFOSWords = %d, %d (after drain)\n", - GLINT_READ_REG(OutFIFOWords), - GLINT_SECONDARY_READ_REG(OutFIFOWords)); -#endif - chipconfig = GLINT_READ_REG(GChipConfig); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); @@ -1449,18 +1466,26 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) switch (chipconfig & GChipMultiGLINTApMask) { case GChipMultiGLINTAp_0M: - pGlint->FbMapSize = 0; + size = 0; break; case GChipMultiGLINTAp_16M: - pGlint->FbMapSize = 16 * 1024 * 1024; + size = 16 * 1024 * 1024; break; case GChipMultiGLINTAp_32M: - pGlint->FbMapSize = 32 * 1024 * 1024; + size = 32 * 1024 * 1024; break; case GChipMultiGLINTAp_64M: - pGlint->FbMapSize = 64 * 1024 * 1024; + size = 64 * 1024 * 1024; break; } + + if (size == 0) { + xf86DrvMsg(pScrn->scrnIndex, from, "MultiAperture: disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, from, "MultiAperture: enabled\n"); + pGlint->FbMapSize = size; + pGlint->MultiAperture = TRUE; + } } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", @@ -1474,6 +1499,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + pGlint->FIFOSize = 256; maxheight = 2048; maxwidth = 2048; pGlint->RefClock = 14318; @@ -1491,6 +1517,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + pGlint->FIFOSize = 256; maxheight = 2048; maxwidth = 2048; pGlint->RefClock = 14318; @@ -1508,6 +1535,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + pGlint->FIFOSize = 120; maxheight = 4096; maxwidth = 4096; pGlint->RefClock = 14318; @@ -1539,13 +1567,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - pGlint->UsePCIRetry) { - xf86DrvMsg(pScrn->scrnIndex, from, - "GAMMA in use - PCI retries disabled\n"); - pGlint->UsePCIRetry = FALSE; - } + pGlint->FIFOSize = 16; if (pScrn->bitsPerPixel == 24) { xf86DrvMsg(pScrn->scrnIndex, from, "-depth 24 -pixmap24 not supported by this chip.\n"); @@ -1571,22 +1593,119 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) pGlint->RefClock = 40000; - else { - xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, - "Undefined RefClock\n"); - return FALSE; - } } } if (!pGlint->RamDac) return FALSE; break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + pGlint->FIFOSize = 32; + if (pScrn->bitsPerPixel == 24) { + xf86DrvMsg(pScrn->scrnIndex, from, + "-depth 24 -pixmap24 not supported by this chip.\n"); + return FALSE; + } + maxheight = 4096; + maxwidth = 4096; + /* Let's do board specific stuff first */ + if (IS_J2000) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Appian Jeronimo 2000 board detected\n"); + pGlint->RefClock = 14318; + pGlint->RamDacRec = RamDacCreateInfoRec(); + pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; + pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; + pGlint->RamDacRec->ReadAddress = Permedia2ReadAddress; + pGlint->RamDacRec->WriteAddress = Permedia2WriteAddress; + pGlint->RamDacRec->ReadData = Permedia2ReadData; + pGlint->RamDacRec->WriteData = Permedia2WriteData; + if(!RamDacInit(pScrn, pGlint->RamDacRec)) { + RamDacDestroyInfoRec(pGlint->RamDacRec); + return FALSE; + } +#if 1 /* REMOVE LATER - see other IS_J2000 fixup code */ + /* As we push the acceleration through the pm3 (for now) we can + * safely set the FIFOSize to 120 again */ + pGlint->FIFOSize = 120; +#endif + break; + } + if (IS_GMX2000) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "3DLabs GMX2000 board detected\n"); + /* We need to wrap these after detection as the second MX + * is the only chip that can write to the TI3030 dac */ + ACCESSCHIP2(); + GLINTProbeTIramdac(pScrn); + ACCESSCHIP1(); + pGlint->RamDacRec->ReadDAC = GMX2000InIndReg; + pGlint->RamDacRec->WriteDAC = GMX2000OutIndReg; + pGlint->RamDacRec->ReadAddress = GMX2000ReadAddress; + pGlint->RamDacRec->WriteAddress = GMX2000WriteAddress; + pGlint->RamDacRec->ReadData = GMX2000ReadData; + pGlint->RamDacRec->WriteData = GMX2000WriteData; + pGlint->RefClock = 14318; + break; + } + /* Test for an TI ramdac */ + if (!pGlint->RamDac) { + GLINTProbeTIramdac(pScrn); + if (pGlint->RamDac) + if ( (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + pGlint->RefClock = 14318; + } + /* Test for an IBM ramdac */ + if (!pGlint->RamDac) { + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac) { + if (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) + pGlint->RefClock = 28322; + else + if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) + pGlint->RefClock = 40000; + } + } + if (!pGlint->RamDac) { + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + pGlint->RefClock = 14318; + pGlint->RamDacRec = RamDacCreateInfoRec(); + pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; + pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; + pGlint->RamDacRec->ReadAddress = Permedia2ReadAddress; + pGlint->RamDacRec->WriteAddress = Permedia2WriteAddress; + pGlint->RamDacRec->ReadData = Permedia2ReadData; + pGlint->RamDacRec->WriteData = Permedia2WriteData; + } + if(!RamDacInit(pScrn, pGlint->RamDacRec)) { + RamDacDestroyInfoRec(pGlint->RamDacRec); + return FALSE; + } + } else + if (!pGlint->RamDac) + return FALSE; + break; } + if (pGlint->FIFOSize) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "FIFO Size is %d DWORDS\n", + pGlint->FIFOSize); + if (pGlint->FBDev || FBDevProbed) pGlint->VGAcore = FALSE; if (pGlint->VGAcore) { + /* Initialize the card through int10 interface if needed */ + if ( xf86LoadSubModule(pScrn, "int10")){ + xf86Int10InfoPtr pInt; + + xf86LoaderReqSymLists(int10Symbols, NULL); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); + pInt = xf86InitInt10(pGlint->pEnt->index); + xf86FreeInt10(pInt); + } + /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; @@ -1634,7 +1753,8 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX)|| (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) ) + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) pGlint->MaxClock = 220000; if ( (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA) ) { @@ -1671,7 +1791,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) break; } } - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) pGlint->MaxClock = 300000; } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", @@ -1698,7 +1820,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* Select valid modes from those available */ if ((pGlint->NoAccel) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)) { + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { /* * XXX Assuming min pitch 256, max <maxwidth> * XXX Assuming min height 128, max <maxheight> @@ -1784,9 +1908,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "GLINT SX/TX/MX chipsets only support one modeline, using first\n"); + "This GLINT chip only supports one modeline, using first\n"); pScrn->modes->next = NULL; pScrn->virtualX = pScrn->modes->HDisplay; pScrn->virtualY = pScrn->modes->VDisplay; @@ -1813,24 +1938,31 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_MX: case PCI_VENDOR_3DLABS_CHIP_300SX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: pGlint->pprod = partprod500TX[pScrn->displayWidth >> 5]; pGlint->bppalign = 0; break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + pGlint->pprod = partprod500TX[pScrn->displayWidth >> 5]; + pGlint->bppalign = 0; + break; + } + break; } if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - int bytesPerPixel, realMXWidthBytes, inputXSpanBytes; + (pGlint->numMultiDevices == 2) ) { + int bytesPerPixel, realWidthBytes, inputXSpanBytes; CARD32 postMultiply, productEnable, use16xProduct, inputXSpan; CARD32 binaryEval, glintApSize; /* setup multi glint framebuffer aperture */ bytesPerPixel = (pScrn->bitsPerPixel >> 3); - realMXWidthBytes = pScrn->displayWidth * bytesPerPixel; + realWidthBytes = pScrn->displayWidth * bytesPerPixel; /* compute Input X Span field */ - binaryEval = ((realMXWidthBytes << 1) - 1); + binaryEval = ((realWidthBytes << 1) - 1); if (binaryEval & (8 << 10)) { /* 8K */ inputXSpan = 3; inputXSpanBytes = 8 * 1024; @@ -1849,7 +1981,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } /* compute post multiply */ - binaryEval = realMXWidthBytes >> 3; + binaryEval = realWidthBytes >> 3; postMultiply = 0; while ((postMultiply < 5) && !(binaryEval & 1)) { postMultiply++; @@ -1894,7 +2026,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) glintApSize = 0 << 10; } - pGlint->realMXWidth = ( glintApSize | + pGlint->realWidth = ( glintApSize | postMultiply | productEnable | use16xProduct | @@ -2107,14 +2239,17 @@ GLINTSave(ScrnInfoPtr pScrn) { GLINTPtr pGlint; GLINTRegPtr glintReg; + GLINTRegPtr glintReg2; RamDacHWRecPtr pRAMDAC; RamDacRegRecPtr RAMDACreg; pGlint = GLINTPTR(pScrn); pRAMDAC = RAMDACHWPTR(pScrn); - glintReg = &pGlint->SavedReg; + glintReg = &pGlint->SavedReg[0]; + glintReg2 = &pGlint->SavedReg[1]; RAMDACreg = &pRAMDAC->SavedReg; TRACE_ENTER("GLINTSave"); + if (pGlint->VGAcore) { vgaRegPtr vgaReg; vgaReg = &VGAHWPTR(pScrn)->SavedReg; @@ -2145,15 +2280,32 @@ GLINTSave(ScrnInfoPtr pScrn) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXSave(pScrn, glintReg); + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXSave(pScrn, glintReg); - } - else { + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2() + TXSave(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXSave(pScrn, glintReg); + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Save(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Save(pScrn, glintReg); + break; } - (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } TRACE_EXIT("GLINTSave"); @@ -2171,9 +2323,10 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { int ret = -1; GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr glintReg; RamDacHWRecPtr pRAMDAC = RAMDACHWPTR(pScrn); RamDacRegRecPtr RAMDACreg; + GLINTRegPtr glintReg = &pGlint->ModeReg[0]; + GLINTRegPtr glintReg2 = &pGlint->ModeReg[1]; if (pGlint->VGAcore) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2195,7 +2348,7 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) ret = Permedia2VInit(pScrn, mode); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - ret = Permedia3Init(pScrn, mode); + ret = Permedia3Init(pScrn, mode, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: @@ -2204,13 +2357,26 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + ret = TXInit(pScrn, mode, glintReg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - ret = DualMXInit(pScrn, mode); - } - else { - ret = TXInit(pScrn, mode); + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + ret = TXInit(pScrn, mode, glintReg2); + ACCESSCHIP1(); + } + ret = TXInit(pScrn, mode, glintReg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + ret = Permedia3Init(pScrn, mode, glintReg2); + ACCESSCHIP1(); + } + ret = Permedia3Init(pScrn, mode, glintReg); + break; } break; } @@ -2226,9 +2392,12 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); } - glintReg = &pGlint->ModeReg; + glintReg = &pGlint->ModeReg[0]; + glintReg2 = &pGlint->ModeReg[1]; RAMDACreg = &pRAMDAC->ModeReg; + pGlint->STATE = FALSE; + switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -2248,15 +2417,32 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXRestore(pScrn, glintReg); - } - else { + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + TXRestore(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec,RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Restore(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Restore(pScrn, glintReg); + break; } - (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } @@ -2278,12 +2464,14 @@ GLINTRestore(ScrnInfoPtr pScrn) { GLINTPtr pGlint; GLINTRegPtr glintReg; + GLINTRegPtr glintReg2; RamDacHWRecPtr pRAMDAC; RamDacRegRecPtr RAMDACreg; pGlint = GLINTPTR(pScrn); pRAMDAC = RAMDACHWPTR(pScrn); - glintReg = &pGlint->SavedReg; + glintReg = &pGlint->SavedReg[0]; + glintReg2 = &pGlint->SavedReg[1]; RAMDACreg = &pRAMDAC->SavedReg; TRACE_ENTER("GLINTRestore"); @@ -2312,15 +2500,32 @@ GLINTRestore(ScrnInfoPtr pScrn) case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXRestore(pScrn, glintReg); - } - else { + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + TXRestore(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec,RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Restore(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Restore(pScrn, glintReg); + break; } - (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } @@ -2334,6 +2539,7 @@ GLINTRestore(ScrnInfoPtr pScrn) } vgaHWProtect(pScrn, FALSE); } + TRACE_EXIT("GLINTRestore"); } @@ -2366,19 +2572,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } - /* Timing problem with PM3 & PM2V chips dont like being blasted */ - /* This solves the dual head problem but trahses the console font. */ - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - /* Graphics Index VGA register don't work in mmio mode - * for the Permedia3 chip, it thrashes the console font. - * Let's keep the IO functions for this instead ... */ - vgaHWWriteIndexProcPtr writeGr = hwp->writeGr; - vgaHWReadIndexProcPtr readGr = hwp->readGr; - vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0); - hwp->writeGr = writeGr; - hwp->readGr = readGr; - } else if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) - vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0); + vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0); vgaHWGetIOBase(hwp); } @@ -2405,6 +2599,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon)); } + /* Initialise the first mode */ if ( (!pGlint->FBDev) && !(GLINTModeInit(pScrn, pScrn->currentMode))) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -2494,10 +2689,8 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit(pScreen, 0, 0); -#endif break; case 32: if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR) @@ -2510,10 +2703,8 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit(pScreen, 0, 0); -#endif } break; default: @@ -2528,6 +2719,9 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); + pGlint->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = GLINTBlockHandler; + if (!pGlint->ShadowFB) GLINTDGAInit(pScreen); @@ -2563,13 +2757,16 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) break; case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXAccelInit(pScreen); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXAccelInit(pScreen); - } - else { + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: TXAccelInit(pScreen); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3AccelInit(pScreen); + break; } break; case PCI_VENDOR_3DLABS_CHIP_300SX: @@ -2592,7 +2789,9 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) Permedia2HWCursorInit(pScreen); else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)) + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) Permedia2vHWCursorInit(pScreen); else /* If we get here pGlint->Ramdac should have been set */ @@ -2610,8 +2809,19 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miCreateDefColormap(pScreen)) return FALSE; + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + (pGlint->FBDev) ? fbdevHWLoadPalette : + ((pScrn->depth == 16) ? Permedia3LoadPalette16:Permedia3LoadPalette), + NULL, + CMAP_RELOAD_ON_MODE_SWITCH | + ((pScrn->overlayFlags & OVERLAY_8_32_PLANAR) + ? 0 : CMAP_PALETTED_TRUECOLOR))) + return FALSE; + } else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) || (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) { if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, @@ -2645,9 +2855,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if(pGlint->ShadowFB) ShadowFBInit(pScreen, GLINTRefreshArea); -#ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)GLINTDisplayPowerManagementSet, 0); -#endif #ifdef XF86DRI if (pGlint->directRenderingEnabled) { @@ -2720,14 +2928,20 @@ GLINTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) PermediaInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_500TX: - case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + SXInitializeEngine(pScrn); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2)) { - DualMXInitializeEngine(pScrn); - } else { - TXInitializeEngine(pScrn); + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3InitializeEngine(pScrn); + break; } break; } @@ -2774,9 +2988,18 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags) case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + GLINT_SLOW_WRITE_REG(base, PMScreenBase); + break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; + GLINT_SLOW_WRITE_REG(base, PMScreenBase); + } + break; } TRACE_EXIT("GLINTAdjustFrame (normal)"); } @@ -2827,14 +3050,20 @@ GLINTEnterVT(int scrnIndex, int flags) PermediaInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_500TX: - case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + SXInitializeEngine(pScrn); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXInitializeEngine(pScrn); - } else { - TXInitializeEngine(pScrn); + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3InitializeEngine(pScrn); + break; } break; } @@ -2860,6 +3089,7 @@ GLINTLeaveVT(int scrnIndex, int flags) GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("GLINTLeaveVT"); + pGlint->STATE = TRUE; GLINTRestore(pScrn); if (pGlint->VGAcore) vgaHWLock(VGAHWPTR(pScrn)); @@ -2903,6 +3133,7 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pGlint->FBDev) fbdevHWRestore(pScrn); else { + pGlint->STATE = TRUE; GLINTRestore(pScrn); if (pGlint->VGAcore) vgaHWLock(VGAHWPTR(pScrn)); @@ -2917,11 +3148,16 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(pGlint->ShadowPtr); if (pGlint->DGAModes) xfree(pGlint->DGAModes); + if (pGlint->ScratchBuffer) + xfree(pGlint->ScratchBuffer); pScrn->vtSema = FALSE; if (xf86IsPc98()) outb(0xfac, 0x00); + if(pGlint->BlockHandler) + pScreen->BlockHandler = pGlint->BlockHandler; + pScreen->CloseScreen = pGlint->CloseScreen; TRACE_EXIT("GLINTCloseScreen"); return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -2934,15 +3170,12 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) static void GLINTFreeScreen(int scrnIndex, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("GLINTFreeScreen"); - if ((pGlint->FBDev || FBDevProbed) && xf86LoaderCheckSymbol("fbdevHWFreeRec")) + if (xf86LoaderCheckSymbol("fbdevHWFreeRec")) fbdevHWFreeRec(xf86Screens[scrnIndex]); - if (pGlint->VGAcore && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(xf86Screens[scrnIndex]); - if (pGlint->RamDacRec && xf86LoaderCheckSymbol("RamDacFreeRec")) + if (xf86LoaderCheckSymbol("RamDacFreeRec")) RamDacFreeRec(xf86Screens[scrnIndex]); GLINTFreeRec(xf86Screens[scrnIndex]); TRACE_EXIT("GLINTFreeScreen"); @@ -3038,6 +3271,14 @@ GLINTSaveScreen(ScreenPtr pScreen, int mode) case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + temp = GLINT_READ_REG(PMVideoControl); + if (unblank) temp |= 1; + else temp &= 0xFFFFFFFE; + GLINT_SLOW_WRITE_REG(temp, PMVideoControl); + } + break; } } @@ -3045,22 +3286,174 @@ GLINTSaveScreen(ScreenPtr pScreen, int mode) return TRUE; } +static void +GLINTBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + GLINTPtr pGlint = GLINTPTR(pScrn); + + if(pGlint->CursorColorCallback) + (*pGlint->CursorColorCallback)(pScrn); + + if(pGlint->LoadCursorCallback) + (*pGlint->LoadCursorCallback)(pScrn); + + pScreen->BlockHandler = pGlint->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = GLINTBlockHandler; +} + #ifdef DEBUG void GLINT_VERB_WRITE_REG(GLINTPtr pGlint, CARD32 v, int r, char *file, int line) { if (xf86GetVerbosity() > 2) ErrorF("[0x%04x] <- 0x%08x (%s, %d)\n", r, v, file, line); - *(volatile CARD32 *)((char *) pGlint->IOBase + r) = v; + *(volatile CARD32 *)((char *) pGlint->IOBase + pGlint->IOOffset + r) = v; } CARD32 GLINT_VERB_READ_REG(GLINTPtr pGlint, CARD32 r, char *file, int line) { - CARD32 v = *(volatile CARD32 *)((char *) pGlint->IOBase + r); + CARD32 v = + *(volatile CARD32 *)((char *) pGlint->IOBase + pGlint->IOOffset + r); if (xf86GetVerbosity() > 2) ErrorF("[0x%04x] -> 0x%08x (%s, %d)\n", r, v, file, line); return v; } #endif + +void GLINT_MoveBYTE( + register CARD32* dest, + register unsigned char* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + while(dwords) { + *dest = *src; + src += 1; + dest += 1; + dwords -= 1; + } +} + +void GLINT_MoveWORDS( + register CARD32* dest, + register unsigned short* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + while(dwords & ~0x01) { + *dest = *src; + *(dest + 1) = *(src + 1); + src += 2; + dest += 2; + dwords -= 2; + } + if (dwords) + *dest = *src; +} + +void GLINT_MoveDWORDS( + register CARD32* dest, + register CARD32* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + while(dwords & ~0x03) { + *dest = *src; + *(dest + 1) = *(src + 1); + *(dest + 2) = *(src + 2); + *(dest + 3) = *(src + 3); + src += 4; + dest += 4; + dwords -= 4; + } + + while(dwords) { + *dest = *src; + src++; + dest++; + dwords--; + } +} + +int +Shiftbpp(ScrnInfoPtr pScrn, int value) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + int logbytesperaccess = 2; /* default */ + + switch (pGlint->Chipset) { + case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + logbytesperaccess = 2; + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + logbytesperaccess = 4; + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + case PCI_VENDOR_3DLABS_CHIP_500TX: + case PCI_VENDOR_3DLABS_CHIP_MX: + if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + logbytesperaccess = 4; + else + logbytesperaccess = 3; + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + logbytesperaccess = 4; + else + logbytesperaccess = 3; + break; + case PCI_CHIP_PERMEDIA3: + logbytesperaccess = 4; + break; + } + } + + switch (pScrn->bitsPerPixel) { + case 8: + value >>= logbytesperaccess; + pGlint->BppShift = logbytesperaccess; + break; + case 16: + if (pGlint->DoubleBuffer) { + value >>= (logbytesperaccess-2); + pGlint->BppShift = logbytesperaccess-2; + } else { + value >>= (logbytesperaccess-1); + pGlint->BppShift = logbytesperaccess-1; + } + break; + case 24: + value *= 3; + value >>= logbytesperaccess; + pGlint->BppShift = logbytesperaccess; + break; + case 32: + value >>= (logbytesperaccess-2); + pGlint->BppShift = logbytesperaccess-2; + break; + } + return (value); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h index 8e319152b..06e1cb265 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.21 2000/09/19 14:12:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.25 2001/02/15 11:03:57 alanh Exp $ */ /* * glint register file @@ -19,16 +19,7 @@ #include "compiler.h" -/********************************************** -* GLINT 500TX Configuration Region Registers * -***********************************************/ - -/* Device Identification */ -#define CFGVendorId 0x0000 -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_TI 0x104C -#define CFGDeviceId 0x0002 - +/* The chips we know */ #define PCI_CHIP_3DLABS_300SX 0x01 #define PCI_CHIP_3DLABS_500TX 0x02 #define PCI_CHIP_3DLABS_DELTA 0x03 @@ -40,6 +31,26 @@ #define PCI_CHIP_3DLABS_PERMEDIA3 0x0A #define PCI_CHIP_TI_PERMEDIA 0x3d04 +/* The boards we know */ +#define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \ + (pGlint->PciInfo->subsysCard == 0x0106)) + +#define IS_J2000 ((pGlint->PciInfo->subsysVendor == 0x1097) && \ + (pGlint->PciInfo->subsysCard == 0x3d32)) + +#define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \ + (pGlint->PciInfo->subsysCard == 0x3db3)) + +/********************************************** +* GLINT 500TX Configuration Region Registers * +***********************************************/ + +/* Device Identification */ +#define CFGVendorId 0x0000 +#define PCI_VENDOR_3DLABS 0x3D3D +#define PCI_VENDOR_TI 0x104C +#define CFGDeviceId 0x0002 + #define CFGRevisionId 0x08 #define CFGClassCode 0x09 #define CFGHeaderType 0x0E @@ -323,6 +334,10 @@ #define PM2VDACRDDClk1PreScale 0x204 #define PM2VDACRDDClk1FeedbackScale 0x205 #define PM2VDACRDDClk1PostScale 0x206 +#define PM2VDACRDMClkControl 0x20D +#define PM2VDACRDMClkPreScale 0x20E +#define PM2VDACRDMClkFeedbackScale 0x20F +#define PM2VDACRDMClkPostScale 0x210 #define PM2VDACRDCursorPalette 0x303 #define PM2VDACRDCursorPattern 0x400 #define PM2VDACIndexRegLow 0x4020 @@ -981,6 +996,8 @@ #define FM_PassStatisticTag 0x1000 #define FM_PassStatisticData 0x2000 +#define Sync_tag 0x0188 + #define StatisticMode GLINT_TAG_ADDR(0x18,0x01) #define MinRegion GLINT_TAG_ADDR(0x18,0x02) #define MaxRegion GLINT_TAG_ADDR(0x18,0x03) @@ -1173,44 +1190,40 @@ GLINT_VERB_READ_REG(pGlint,r,__FILE__,__LINE__) #else -#define GLINT_WRITE_REG(v,r) MMIO_OUT32(pGlint->IOBase,(unsigned long)r, v) -#define GLINT_READ_REG(r) MMIO_IN32(pGlint->IOBase,(unsigned long)r) -#define GLINT_SECONDARY_WRITE_REG(v,r) \ - MMIO_OUT32(pGlint->IOBase,(unsigned long)r+0x10000, v) -#define GLINT_SECONDARY_READ_REG(r) \ - MMIO_IN32(pGlint->IOBase,(unsigned long)r+0x10000) +#define GLINT_WRITE_REG(v,r) \ + MMIO_OUT32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r), (v)) +#define GLINT_READ_REG(r) \ + MMIO_IN32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r)) #endif /* DEBUG */ #define GLINT_WAIT(n) \ do{ \ - if(!pGlint->UsePCIRetry) \ - while(GLINT_READ_REG(InFIFOSpace)<(n)){ \ - mem_barrier(); \ - } \ + while(GLINT_READ_REG(InFIFOSpace)<(n)); \ }while(0) -#define GLINT_MASK_WRITE_REG(v,m,r) \ - GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) - #define GLINTDACDelay(x) do { \ int delay = x; \ unsigned char tmp; \ while(delay--){tmp = GLINT_READ_REG(InFIFOSpace);}; \ } while(0) +#define GLINT_MASK_WRITE_REG(v,m,r) \ + GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) + #define GLINT_SLOW_WRITE_REG(v,r) \ do{ \ - GLINTDACDelay(5); \ + mem_barrier(); \ + GLINT_WAIT(1); \ + mem_barrier(); \ GLINT_WRITE_REG(v,r); \ - GLINTDACDelay(5); \ }while(0) -#define GLINT_SECONDARY_SLOW_WRITE_REG(v,r) \ -do{ \ - while(GLINT_READ_REG(InFIFOSpace)<1); \ - GLINT_SECONDARY_WRITE_REG(v,r); \ -}while(0) +#define GLINT_SET_INDEX(index) \ +do{ \ + GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \ + GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \ +} while(0) #define REPLICATE(r) \ { \ @@ -1266,4 +1279,38 @@ do{ \ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ } #endif + +/* Permedia Save/Restore functions */ + +#define STOREREG(address,value) \ + pReg->glintRegs[address >> 3] = value; + +#define SAVEREG(address) \ + pReg->glintRegs[address >> 3] = GLINT_READ_REG(address); + +#define RESTOREREG(address) \ + GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address); + +#define STOREDAC(address,value) \ + pReg->DacRegs[address] = value; + +#define P2VOUT(address) \ + Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]); + +#define P2VIN(address) \ + pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address); + +/* RamDac Save/Restore functions, used by external DAC's */ + +#define STORERAMDAC(address,value) \ + ramdacReg->DacRegs[address] = value; + +/* Multi Chip access */ + +#define ACCESSCHIP1() \ + pGlint->IOOffset = 0; + +#define ACCESSCHIP2() \ + pGlint->IOOffset = 0x10000; + #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c index 65b7d0b36..ef3a1b1bb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,7 +30,7 @@ * * Permedia 2 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.24 2000/03/31 22:55:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.28 2001/02/15 11:03:57 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -115,18 +115,10 @@ static void Permedia2WritePixmap16bpp(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void Permedia2WritePixmap24bpp(ScrnInfoPtr pScrn, int x, int y, int w, - int h, unsigned char *src, int srcwidth, - int rop, unsigned int planemask, - int transparency_color, int bpp, int depth); static void Permedia2WritePixmap32bpp(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void Permedia2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask); -static void Permedia2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); static void Permedia2SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -141,8 +133,6 @@ static void Permedia2PolylinesThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, static void Permedia2PolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSeg); -#define MAX_FIFO_ENTRIES 256 - #if X_BYTE_ORDER == X_BIG_ENDIAN # define STIPPLE_SWAP 1<<18 /* Mirror stipple pattern horizontally */ #else @@ -182,7 +172,7 @@ Permedia2InitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0xc00, FilterMode); + GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); @@ -328,35 +318,21 @@ Permedia2AccelInit(ScreenPtr pScreen) Permedia2SubsequentMono8x8PatternFillRect; } - if (pGlint->UsePCIRetry) { - infoPtr->CPUToScreenColorExpandFillFlags = SYNC_AFTER_COLOR_EXPAND | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_PAD_DWORD; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - Permedia2SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - Permedia2SubsequentCPUToScreenColorExpandFill; - } else { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - BIT_ORDER_IN_BYTE_LSBFIRST; - - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; - pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = Permedia2SetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = Permedia2SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = Permedia2SubsequentColorExpandScanline; - } - - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; infoPtr->WriteBitmap = Permedia2WriteBitmap; @@ -366,13 +342,6 @@ Permedia2AccelInit(ScreenPtr pScreen) if (pScrn->bitsPerPixel == 16) infoPtr->WritePixmap = Permedia2WritePixmap16bpp; else -#if 0 - if (pScrn->bitsPerPixel == 24) { - infoPtr->WritePixmap = Permedia2WritePixmap24bpp; - infoPtr->WritePixmapFlags |= NO_PLANEMASK; - } - else -#endif if (pScrn->bitsPerPixel == 32) infoPtr->WritePixmap = Permedia2WritePixmap32bpp; @@ -381,7 +350,6 @@ Permedia2AccelInit(ScreenPtr pScreen) infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK; infoPtr->WriteBitmapFlags |= NO_PLANEMASK; - infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; } @@ -427,11 +395,11 @@ Permedia2Sync(ScrnInfoPtr pScrn) CHECKCLIPPING; while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(1); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); } @@ -733,63 +701,6 @@ Permedia2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) TRACE_EXIT("Permedia2SubsequentFillRectSolid"); } -static void MoveBYTE( - register CARD32* dest, - register unsigned char* src, - register int dwords -) -{ - while(dwords) { - *dest = *src; - src += 1; - dest += 1; - dwords -= 1; - } -} - -static void MoveWORDS( - register CARD32* dest, - register unsigned short* src, - register int dwords -) -{ - while(dwords & ~0x01) { - *dest = *src; - *(dest + 1) = *(src + 1); - src += 2; - dest += 2; - dwords -= 2; - } - switch(dwords) { - case 0: return; - case 1: *dest = *src; - return; - } -} - -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - - static void Permedia2SetupForMono8x8PatternFill24bpp(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -939,82 +850,6 @@ Permedia2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, } static void -Permedia2SetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dobackground = 0; - - TRACE_ENTER("Permedia2SetupForCPUToScreenColorExpandFill"); - if (bg != -1) dobackground |= ForceBackgroundColor; - - GLINT_WAIT(7); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - - pGlint->ForeGroundColor = fg; - pGlint->BackGroundColor = bg; - REPLICATE(fg); - REPLICATE(bg); - - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - if (dobackground) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, FBBlockColor); - } - GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); - GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground| - pGlint->RasterizerSwap,RasterizerMode); - GLINT_WRITE_REG(fg, ConstantColor); - if (dobackground) { - pGlint->FrameBufferReadMode = TextureEnable; - GLINT_WRITE_REG(bg, Texel0); - } else - pGlint->FrameBufferReadMode = 0; - } - LOADROP(rop); - TRACE_EXIT("Permedia2SetupForCPUToScreenColorExpandFill"); -} - -static void -Permedia2SubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - - TRACE_ENTER("Permedia2SubsequentCPUToScreenColorExpandFill"); - GLINT_WAIT(8); - Permedia2LoadCoord(pScrn, x, y, w, h); - - if ((pGlint->ROP == GXcopy) && (pGlint->BackGroundColor != -1)) { - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | FastFillEnable, Render); - REPLICATE(pGlint->ForeGroundColor) - GLINT_WRITE_REG(pGlint->ForeGroundColor, FBBlockColor); - } - - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | SyncOnBitMask | - pGlint->FrameBufferReadMode, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - GLINT_WAIT(dwords); - TRACE_EXIT("Permedia2SubsequentCPUToScreenColorExpandFill"); -} - -static void Permedia2SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, @@ -1141,44 +976,28 @@ Permedia2WriteBitmap(ScrnInfoPtr pScrn, } if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } - } else if(rop == GXcopy) { - /* >>>>> set bg <<<<<<< */ - /* >>>>> draw rect (x,y,w,h) */ + } else if((rop == GXcopy) && (pScrn->bitsPerPixel != 24)) { REPLICATE(bg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, ConstantColor); - } - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |mode,Render); - /* >>>>>> set fg <<<<<< */ + GLINT_WRITE_REG(bg, FBBlockColor); + GLINT_WRITE_REG(PrimitiveRectangle | XPositive |YPositive |mode,Render); REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, ConstantColor); - } + GLINT_WRITE_REG(fg, FBBlockColor); } else { SecondPass = TRUE; - /* >>>>> set fg <<<<<<< */ REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } } - /* >>>>>>>>> initiate transfer (x,y,w,h). Skipleft pixels on the - left edge will be clipped <<<<<< */ - SECOND_PASS: GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | mode | SyncOnBitMask, Render); @@ -1188,17 +1007,16 @@ SECOND_PASS: GLINT_WAIT(dwords); /* 0x0D is the TAG value for BitMaskPattern */ GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32 *)srcpntr, dwords); srcpntr += srcwidth; } if(SecondPass) { SecondPass = FALSE; - /* >>>>>> invert bitmask and set bg <<<<<<<< */ REPLICATE(bg); GLINT_WAIT(3); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,RasterizerMode); GLINT_WRITE_REG(bg, FBBlockColor); } else { @@ -1276,24 +1094,27 @@ Permedia2WritePixmap8bpp( count = dwords; address = ((y * pScrn->displayWidth) + x) >> 2; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1305,6 +1126,7 @@ Permedia2WritePixmap8bpp( char align = (x & pGlint->bppalign); + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); if (rop == GXcopy) { GLINT_WAIT(6); @@ -1324,22 +1146,24 @@ Permedia2WritePixmap8bpp( while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1348,22 +1172,24 @@ Permedia2WritePixmap8bpp( while(h--) { count = w; srcpbyte = (unsigned char *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpbyte += MAX_FIFO_ENTRIES - 1; + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (unsigned char *)srcpbyte, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcpbyte += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned char *)srcpbyte, count); } src += srcwidth; @@ -1435,24 +1261,27 @@ Permedia2WritePixmap16bpp( count = dwords; address = ((y * pScrn->displayWidth) + x) >> 1; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1483,22 +1312,24 @@ Permedia2WritePixmap16bpp( while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1507,22 +1338,24 @@ Permedia2WritePixmap16bpp( while(h--) { count = w; srcpword = (unsigned short *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned short *)srcpword, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpword += MAX_FIFO_ENTRIES - 1; + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (unsigned short *)srcpword, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcpword += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned short *)srcpword, count); } src += srcwidth; @@ -1536,107 +1369,6 @@ Permedia2WritePixmap16bpp( } static void -Permedia2WritePixmap24bpp( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth -) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - int skipleft = 0, dwords, count; - unsigned char* srcpbyte; - CARD32* srcp; - - GLINT_WAIT(3); - GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - - dwords = ((w+1)*3)>>2; - if((skipleft = (long)src & 0x03L)) { - skipleft = 4 - skipleft; - - x -= skipleft; - w += skipleft; - - src = (unsigned char*)(src - (3*skipleft)); - } - - { - Permedia2SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h); - - GLINT_WAIT(4); - Permedia2LoadCoord(pScrn, x&0xFFFF, y, w, h); - LOADROP(rop); - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | - SyncOnHostData, Render); - -#if 1 - while(h--) { - count = w; - srcpbyte = (unsigned char *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpbyte += MAX_FIFO_ENTRIES - 1; - } - if(count) { - GLINT_WAIT(count + 1); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, count); - } - src += srcwidth; -#else - while(h--) { - count = dwords; - srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; - } - if(count) { - GLINT_WAIT(count + 1); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, count); - } - src += srcwidth; -#endif - } - } - - Permedia2DisableClipping(pScrn); - SET_SYNC_FLAG(infoRec); -} - - -static void Permedia2WritePixmap32bpp( ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -1689,24 +1421,27 @@ Permedia2WritePixmap32bpp( count = dwords; address = (y * pScrn->displayWidth) + x; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1727,22 +1462,24 @@ Permedia2WritePixmap32bpp( while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c index 45f605dd5..604ed1533 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>. + * Copyright 2000-2001 by Sven Luther <luther@dpt-info.u-strasbg.fr>. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -26,7 +26,7 @@ * * Permedia 3 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.7 2000/11/28 16:10:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.22 2001/02/05 15:10:43 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -47,7 +47,6 @@ #include "xaalocal.h" /* For replacements */ #define DEBUG 0 -#define USE_DIRECT_FIFO_WRITES 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("pm3_accel: " str " %d\n",pScrn->scrnIndex) @@ -61,6 +60,7 @@ /* Sync */ void Permedia3Sync(ScrnInfoPtr pScrn); +void DualPermedia3Sync(ScrnInfoPtr pScrn); /* Clipping */ static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y, int w, int h); @@ -78,6 +78,8 @@ static void Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h); +static void Permedia3SubsequentFillRectSolid32bpp(ScrnInfoPtr pScrn, int x, + int y, int w, int h); /* 8x8 Mono Pattern Fills */ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, @@ -85,26 +87,28 @@ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, static void Permedia3SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int x_offset, int y_offset, int x, int y, int w, int h); -/* Color Expansion Fills */ -static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask); -static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -/* Direct Fifo Bitmap Writes */ -static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int skipleft, - int fg, int bg, int rop,unsigned int planemask); -/* Images Writes */ -static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop, +static void Permedia3SetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void Permedia3SubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, + int y, int w, int h, int skipleft); +static void Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth); -static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn, +static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); -/* Direct Fifo Pixmap Writes */ +static void Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); +static void Permedia3RestoreAccelState(ScrnInfoPtr pScrn); static void Permedia3WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); +static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned char *src, int srcwidth, int skipleft, + int fg, int bg, int rop,unsigned int planemask); void Permedia3InitializeEngine(ScrnInfoPtr pScrn) @@ -115,14 +119,23 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) /* Initialize the Accelerator Engine to defaults */ TRACE_ENTER("Permedia3InitializeEngine"); + if (pGlint->MultiAperture) { + /* Only write the following register to the first PM3 */ + GLINT_SLOW_WRITE_REG(1, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); + + /* Only write the following register to the second PM3 */ + GLINT_SLOW_WRITE_REG(2, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); + + /* Make sure the rest of the register writes go to both PM3's */ + GLINT_SLOW_WRITE_REG(3, BroadcastMask); + } + /* Host out PreInit */ /* Set filter mode to enable sync tag & data output */ - GLINT_SLOW_WRITE_REG(0xc00, FilterMode); + GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - Permedia3Sync(pScrn); - - TRACE("Permedia3InitializeEngine : first sync"); - /* Disable most units by default */ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3DeltaMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); @@ -171,7 +184,6 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(0, PM3DeltaControl); GLINT_SLOW_WRITE_REG(0xffffffff, BitMaskPattern); - Permedia3Sync(pScrn); /* ScissorStippleUnit Initialization (is it needed ?) */ pGlint->ClippingOn = FALSE; @@ -184,14 +196,12 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) (0&0xffff)|((0&0xffff)<<16), WindowOrigin); */ - Permedia3Sync(pScrn); /* StencilDepthUnit Initialization */ GLINT_SLOW_WRITE_REG(0, PM3Window); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode); GLINT_SLOW_WRITE_REG(0, StencilData); - Permedia3Sync(pScrn); /* FBReadUnit Initialization */ TRACE("Permedia3InitializeEngine : only syncs upto now"); @@ -242,30 +252,29 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) TRACE("Permedia3InitializeEngine : SourceRead"); switch (pScrn->bitsPerPixel) { case 8: - GLINT_SLOW_WRITE_REG(0x2, PixelSize); + pGlint->PM3_PixelSize = 2; #if X_BYTE_ORDER == X_BIG_ENDIAN pGlint->RasterizerSwap = 3<<15; /* Swap host data */ #endif break; case 16: - GLINT_SLOW_WRITE_REG(0x1, PixelSize); + pGlint->PM3_PixelSize = 1; #if X_BYTE_ORDER == X_BIG_ENDIAN pGlint->RasterizerSwap = 2<<15; /* Swap host data */ #endif break; case 32: - GLINT_SLOW_WRITE_REG(0x0, PixelSize); + pGlint->PM3_PixelSize = 0; break; } + GLINT_SLOW_WRITE_REG(pGlint->PM3_PixelSize, PixelSize); #if X_BYTE_ORDER == X_BIG_ENDIAN GLINT_SLOW_WRITE_REG(1 | pGlint->RasterizerSwap, RasterizerMode); #endif TRACE("Permedia3InitializeEngine : PixelSize"); - Permedia3Sync(pScrn); /* LogicalOpUnit Initialization */ GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - Permedia3Sync(pScrn); /* FBWriteUnit Initialization */ GLINT_SLOW_WRITE_REG( @@ -278,7 +287,6 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG( PM3FBWriteBufferWidth_Width(pScrn->displayWidth), PM3FBWriteBufferWidth0); - Permedia3Sync(pScrn); /* GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr1); GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset1); @@ -305,7 +313,6 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) (pScrn->bitsPerPixel * pScrn->displayWidth)), PM3SizeOfFramebuffer); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); - Permedia3Sync(pScrn); TRACE("Permedia3InitializeEngine : FBHardwareWriteMask & SizeOfFramebuffer"); /* Color Format */ switch (pScrn->depth) { @@ -346,6 +353,8 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(0, StartXSub); GLINT_SLOW_WRITE_REG(0, StartY); GLINT_SLOW_WRITE_REG(0, GLINTCount); + if (*pGlint->AccelInfoRec->Sync) + (*pGlint->AccelInfoRec->Sync)(pScrn); TRACE_EXIT("Permedia3InitializeEngine"); } @@ -360,36 +369,30 @@ Permedia3AccelInit(ScreenPtr pScreen) pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; - Permedia3InitializeEngine(pScrn); - /* Generic accel engine flags */ - infoPtr->Flags = - PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; + infoPtr->Flags = PIXMAP_CACHE | + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; /* Synchronization of the accel engine */ - infoPtr->Sync = Permedia3Sync; + if (pGlint->MultiAperture) + infoPtr->Sync = DualPermedia3Sync; + else + infoPtr->Sync = Permedia3Sync; + + Permedia3InitializeEngine(pScrn); /* Clipping Setup */ infoPtr->ClippingFlags = 0; - /* This does not work correctly, i don't know why, but i guess it is - * because the clipping stuff is not ok ... - * Let's disable it for now (also in the respective functions, we - * clear the UserScissorEnable bit in Render2D. - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SOLID_FILL; - */ infoPtr->SetClippingRectangle = Permedia3SetClippingRectangle; infoPtr->DisableClipping = Permedia3DisableClipping; /* ScreenToScreenCopy */ - infoPtr->ScreenToScreenCopyFlags = - NO_TRANSPARENCY; + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; infoPtr->SetupForScreenToScreenCopy = - Permedia3SetupForScreenToScreenCopy; + Permedia3SetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy = - Permedia3SubsequentScreenToScreenCopy; + Permedia3SubsequentScreenToScreenCopy; /* SolidFill */ infoPtr->SolidFillFlags = 0; @@ -397,80 +400,84 @@ Permedia3AccelInit(ScreenPtr pScreen) infoPtr->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid; /* 8x8 Mono Pattern Fills */ - infoPtr->Mono8x8PatternFillFlags = - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_LSBFIRST; + infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + HARDWARE_PATTERN_SCREEN_ORIGIN | + BIT_ORDER_IN_BYTE_LSBFIRST; infoPtr->SetupForMono8x8PatternFill = - Permedia3SetupForMono8x8PatternFill; + Permedia3SetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - Permedia3SubsequentMono8x8PatternFillRect; + Permedia3SubsequentMono8x8PatternFillRect; + + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X | + BIT_ORDER_IN_BYTE_LSBFIRST | + CPU_TRANSFER_PAD_DWORD; + + infoPtr->NumScanlineColorExpandBuffers = 1; + pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4) + + (pScrn->virtualX + * pScrn->bitsPerPixel / 8)); + infoPtr->ScanlineColorExpandBuffers = + pGlint->XAAScanlineColorExpandBuffers; + pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->IOBase + OutputFIFO + 4; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + Permedia3SetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + Permedia3SubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + Permedia3SubsequentColorExpandScanline; + + infoPtr->ScanlineImageWriteFlags = NO_GXCOPY | + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X | + BIT_ORDER_IN_BYTE_LSBFIRST | + CPU_TRANSFER_PAD_DWORD; + infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->ScanlineImageWriteBuffers = + pGlint->XAAScanlineColorExpandBuffers; + infoPtr->SetupForScanlineImageWrite = + Permedia3SetupForScanlineImageWrite; + infoPtr->SubsequentScanlineImageWriteRect = + Permedia3SubsequentScanlineImageWriteRect; + infoPtr->SubsequentImageWriteScanline = + Permedia3SubsequentImageWriteScanline; -#if USE_DIRECT_FIFO_WRITES - /* Direct Fifo Bitmap Writes */ - infoPtr->WriteBitmapFlags = 0; infoPtr->WriteBitmap = Permedia3WriteBitmap; -#endif + infoPtr->WriteBitmapFlags = 0; - /* Color Expand Fills */ - infoPtr->CPUToScreenColorExpandFillFlags = - /* - SYNC_AFTER_COLOR_EXPAND | - */ - LEFT_EDGE_CLIPPING | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_BASE_FIXED | - CPU_TRANSFER_PAD_DWORD; - infoPtr->ColorExpandBase = pGlint->IOBase + BitMaskPattern; - infoPtr->ColorExpandRange = 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - Permedia3SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - Permedia3SubsequentCPUToScreenColorExpandFill; - -#if USE_DIRECT_FIFO_WRITES - /* Direct Fifo Images Writes */ - infoPtr->WritePixmapFlags = 0; infoPtr->WritePixmap = Permedia3WritePixmap; -#else - /* Images Writes */ - infoPtr->ImageWriteFlags = - NO_GXCOPY | - /* - SYNC_AFTER_IMAGE_WRITE | - */ - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_BASE_FIXED | - CPU_TRANSFER_PAD_DWORD; - infoPtr->ImageWriteBase = pGlint->IOBase + PM3FBSourceData; - infoPtr->ImageWriteRange = 4; - infoPtr->SetupForImageWrite = - Permedia3SetupForImageWrite; - infoPtr->SubsequentImageWriteRect = - Permedia3SubsequentImageWriteRect; -#endif + infoPtr->WritePixmapFlags = 0; /* Available Framebuffer Area for XAA. */ AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = pGlint->FbMapSize / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - /* Alan does this ??? + /* X coords are short's so we have to do this to make sure we dont wrap*/ AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 : - pGlint->FbMapSize) / (pScrn->displayWidth + pGlint->FbMapSize) / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - */ /* Permedia3 has a maximum 4096x4096 framebuffer */ if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095; + { + Bool shared_accel = FALSE; + int i; + + for(i = 0; i < pScrn->numEntities; i++) { + if(xf86IsEntityShared(pScrn->entityList[i])) + shared_accel = TRUE; + } + if(shared_accel == TRUE) + infoPtr->RestoreAccelState = Permedia3RestoreAccelState; + } + xf86InitFBManager(pScreen, &AvailFBArea); - Permedia3Sync(pScrn); return(XAAInit(pScreen, infoPtr)); } @@ -491,11 +498,41 @@ Permedia3Sync(ScrnInfoPtr pScrn) CHECKCLIPPING; while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(1); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); - } while (GLINT_READ_REG(OutputFIFO) != PM3SyncTag); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); +} + +void +DualPermedia3Sync( + ScrnInfoPtr pScrn +){ + GLINTPtr pGlint = GLINTPTR(pScrn); + + CHECKCLIPPING; + + while (GLINT_READ_REG(DMACount) != 0); + GLINT_WAIT(3); + GLINT_WRITE_REG(3, BroadcastMask); /* hack! this shouldn't need to be reloaded */ + GLINT_WRITE_REG(0x400, FilterMode); + GLINT_WRITE_REG(0, GlintSync); + + /* Read 1st PM3 until Sync Tag shows */ + ACCESSCHIP1(); + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); + + ACCESSCHIP2(); + /* Read 2nd PM3 until Sync Tag shows */ + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); + + ACCESSCHIP1(); } static void @@ -523,26 +560,34 @@ Permedia3SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForScreenToScreenCopy"); + pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_Operation_Normal; + pGlint->ClippingOn = TRUE; + pGlint->PM3_Config2D = PM3Config2D_UserScissorEnable | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; + if (xdir == 1) pGlint->PM3_Render2D |= PM3Render2D_XPositive; if (ydir == 1) pGlint->PM3_Render2D |= PM3Render2D_YPositive; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXnoop)&&(rop!=GXinvert)) { pGlint->PM3_Render2D |= PM3Render2D_FBSourceReadEnable; pGlint->PM3_Config2D |= PM3Config2D_Blocking; } + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + GLINT_WAIT(2); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + TRACE_EXIT("Permedia3SetupForScreenToScreenCopy"); } static void @@ -578,10 +623,8 @@ Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForFillRectSolid"); - REPLICATE(color); - /* Prepapre Common Render2D & Config2D data */ + /* Prepare Common Render2D & Config2D data */ pGlint->PM3_Render2D = - PM3Render2D_SpanOperation | PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_Normal; @@ -590,28 +633,42 @@ Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; - if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) - pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; - /* Clipping is not working ok yet, let's disable it. - if (pGlint->ClippingOn) - pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable; - */ GLINT_WAIT(3); - /* Using FBClockColor (have to disable SpanOperation) will fill only the - * first 32 pixels of the 64 pixels of a span. Lets use ForegroundColor - * instead (from the LogicOps unit) - GLINT_WRITE_REG(color, PM3FBBlockColor); + REPLICATE(color); + /* We can't do block fills properly at 32bpp, so we can stick the chip + * into 16bpp and double the width and xcoord, but it seems that at + * extremely high resolutions (above 1600) it doesn't fill. + * so, we fall back to the slower span filling method. */ - GLINT_WRITE_REG(color, PM3ForegroundColor); + if ((rop == GXcopy) && (pScrn->bitsPerPixel == 32) && + (pScrn->displayWidth <= 1600)) { + pGlint->AccelInfoRec->SubsequentSolidFillRect = + Permedia3SubsequentFillRectSolid32bpp; + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->AccelInfoRec->SubsequentSolidFillRect = + Permedia3SubsequentFillRectSolid; + /* Can't do block fills at 8bpp either */ + if ((rop == GXcopy) && (pScrn->bitsPerPixel == 16)) { + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; + GLINT_WRITE_REG(color, PM3ForegroundColor); + } + } + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForFillRectSolid"); } + static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SubsequentFillRectSolid"); + GLINT_WAIT(2); GLINT_WRITE_REG( PM3RectanglePosition_XOffset(x) | @@ -620,8 +677,42 @@ Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); + TRACE_EXIT("Permedia3SubsequentFillRectSolid"); } + +static void +Permedia3SubsequentFillRectSolid32bpp(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + TRACE_ENTER("Permedia3SubsequentFillRectSolid32bpp"); + + GLINT_WAIT(6); + + /* Put the chip into 16bpp mode */ + GLINT_WRITE_REG(1, PixelSize); + /* Now double the displayWidth */ + GLINT_WRITE_REG( + PM3FBWriteBufferWidth_Width(pScrn->displayWidth<<1), + PM3FBWriteBufferWidth0); + + /* and double the x,w coords */ + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x<<1) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w<<1) | PM3Render2D_Height(h), + PM3Render2D); + + /* Now fixup */ + GLINT_WRITE_REG( + PM3FBWriteBufferWidth_Width(pScrn->displayWidth), + PM3FBWriteBufferWidth0); + GLINT_WRITE_REG(0, PixelSize); + TRACE_EXIT("Permedia3SubsequentFillRectSolid32bpp"); +} + /* 8x8 Mono Pattern Fills */ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, @@ -645,10 +736,6 @@ Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, PM3Config2D_FBWriteEnable; if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; - /* Clipping is not working correctly yet ... - if (pGlint->ClippingOn) - pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable; - */ pGlint->PM3_AreaStippleMode = 1; /* Mirror stipple pattern horizontally */ #if X_BYTE_ORDER == X_BIG_ENDIAN @@ -699,12 +786,15 @@ Permedia3SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, TRACE_EXIT("Permedia3SubsequentMono8x8PatternFillRect"); } -/* Color Expansion Fills */ -static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask) -{ +static void +Permedia3SetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask +){ GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SetupForCPUToScreenColorExpandFill"); + REPLICATE(fg); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | @@ -729,14 +819,23 @@ static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, GLINT_WRITE_REG(fg, PM3ForegroundColor); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); - TRACE_EXIT("Permedia3SetupForCPUToScreenColorExpandFill"); } -static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) -{ + +static void +Permedia3SubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft +){ GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SubsequentCPUToScreenColorExpandFill"); - GLINT_WAIT(4); + + TRACE_ENTER("Permedia2SubsequentScanlineCPUToScreenColorExpandFill"); + + pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ + + pGlint->cpucount = h; + + GLINT_WAIT(5); GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); GLINT_WRITE_REG( @@ -746,16 +845,55 @@ static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - TRACE_EXIT("Permedia3SubsequentCPUToScreenColorExpandFill"); + + if ((pGlint->dwords*h) < pGlint->FIFOSize) { + /* Turn on direct for less than 120 dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO); + GLINT_WAIT(pGlint->dwords*h); + } else { + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; + } + + pGlint->cpucount--; } +static void +Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; + int dwords = pGlint->dwords; + + if (!pGlint->ScanlineDirect) { + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, dwords); + } + } +} /* Images Writes */ -static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop, +static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth) { GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SetupForImageWrite"); + TRACE_ENTER("Permedia3SetupForScanlineImageWrite"); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_XPositive | @@ -771,14 +909,18 @@ static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop, GLINT_WAIT(2); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); - TRACE_EXIT("Permedia3SetupForImageWrite"); + TRACE_EXIT("Permedia3SetupForScanlineImageWrite"); } -static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn, + +static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SubsequentImageWrite"); - GLINT_WAIT(4); + TRACE_ENTER("Permedia3SubsequentScanlineImageWrite"); + pGlint->dwords = (((w * pScrn->bitsPerPixel) + 3) >> 2); /* per scanline */ + + pGlint->cpucount = h; + GLINT_WAIT(5); GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); GLINT_WRITE_REG( @@ -788,81 +930,62 @@ static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn, GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - TRACE_EXIT("Permedia3SubsequentImageWrite"); -} + if (pGlint->dwords < pGlint->FIFOSize) { + /* Turn on direct for less than 120 dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | (0x15<<4) | 0x05, + OutputFIFO); + GLINT_WAIT(pGlint->dwords); + } else { + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; + } -/* Defines for Direct Fifo access */ - -#define WriteRange 120 -#define PciRetryWriteRange 1023 -#define WriteBase_Fixed ((CARD32 *)(pGlint->IOBase + PM3FBSourceData)) -#define WriteBase ((CARD32 *)(pGlint->IOBase + OutputFIFO + 4)) - -/* Direct Fifo Bitmap Writes */ + pGlint->cpucount--; + TRACE_EXIT("Permedia3SubsequentScanlineImageWrite"); +} static void -Permedia3WriteBitmap(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int skipleft, - int fg, int bg, int rop, - unsigned int planemask -) +Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) { - int dwords; - int ApertureRange; GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3WriteBitmap"); + int dwords = pGlint->dwords; - w += skipleft; - x -= skipleft; - dwords = (w + 31) >>5; - if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange; - else ApertureRange = WriteRange; - - /* width of the stuff to copy in 32 bit words */ - Permedia3SetupForCPUToScreenColorExpandFill(pScrn, fg, bg, rop, planemask); - Permedia3SubsequentCPUToScreenColorExpandFill(pScrn, x, y, w, h, skipleft); - - if (dwords > ApertureRange) { - while(h--) { - XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords); - src += srcwidth; - } + if (pGlint->ScanlineDirect) { + if (pGlint->cpucount--) + GLINT_WAIT(dwords); + return; } else { - /* the src is exatcly as wide as the target rectangle. We copy all - * of it, so no need to separate stuff by scanline */ - if(srcwidth == (dwords << 5)) { - /* decrement contains the number of lines that can be - * put in the fifo */ - int decrement = ApertureRange/dwords; - - while(h > decrement) { - GLINT_WAIT(dwords * decrement); - GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0xd, - OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if(h) { - GLINT_WAIT(dwords * h); - GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0xd, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG(((dwords-1) << 16) | 0xd, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords); - src += srcwidth; - } + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno], + pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno], + dwords); } } - TRACE_EXIT("Permedia3WriteBitmap"); } -/* Direct Fifo Images Writes */ + +static void +Permedia3RestoreAccelState(ScrnInfoPtr pScrn) +{ + Permedia3Sync(pScrn); +} static void Permedia3WritePixmap( @@ -877,9 +1000,10 @@ Permedia3WritePixmap( ) { int dwords; + int count; int skipleft = (long)src & 0x03L; int Bpp = bpp >> 3; - int ApertureRange; + CARD32 *srcp; GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3WritePixmap"); @@ -893,51 +1017,143 @@ Permedia3WritePixmap( x -= skipleft; w += skipleft; - + src = (unsigned char*)((long)src & ~0x03L); } - Permedia3SetupForImageWrite(pScrn, rop, planemask, trans, bpp, depth); - Permedia3SubsequentImageWriteRect(pScrn, x, y, w, h, skipleft); + pGlint->PM3_Render2D = + PM3Render2D_SpanOperation | + PM3Render2D_XPositive | + PM3Render2D_YPositive | + PM3Render2D_Operation_SyncOnHostData; + pGlint->PM3_Config2D = + PM3Config2D_UserScissorEnable | + PM3Config2D_ForegroundROPEnable | + PM3Config2D_ForegroundROP(rop) | + PM3Config2D_FBWriteEnable; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + GLINT_WAIT(6); + DO_PLANEMASK(planemask); + GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); + GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w) | PM3Render2D_Height(h), + PM3Render2D); /* width of the stuff to copy in 32 bit words */ dwords = ((w * Bpp) + 3) >> 2; - if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange; - else ApertureRange = WriteRange; - if (dwords > ApertureRange) { - while(h--) { - XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords); - src += srcwidth; + while(h--) { + count = dwords; + srcp = (CARD32*)src; + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } - } else { - /* the src is exatcly as wide as the target rectangle. We copy all - * of it, so no need to separate stuff by scanline */ - if(srcwidth == (dwords << 2)) { - /* decrement contains the number of lines that can be - * put in the fifo */ - int decrement = ApertureRange/dwords; - - while(h > decrement) { - GLINT_WAIT(dwords * decrement); - GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0x155, - OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if(h) { - GLINT_WAIT(dwords * h); - GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0x155, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG(((dwords-1) << 16) | 0x155, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords); - src += srcwidth; - } + if(count) { + GLINT_WAIT(count + 1); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, count); } + src += srcwidth; + } + + Permedia3DisableClipping(pScrn); + Permedia3Sync(pScrn); +} + +static void +Permedia3WriteBitmap(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned char *src, + int srcwidth, int skipleft, + int fg, int bg, int rop, + unsigned int planemask +) +{ + int dwords; + GLINTPtr pGlint = GLINTPTR(pScrn); + int count; + CARD32 *srcp; + TRACE_ENTER("Permedia3WriteBitmap"); + + w += skipleft; + x -= skipleft; + dwords = (w + 31) >>5; + + REPLICATE(fg); + pGlint->PM3_Render2D = + PM3Render2D_SpanOperation | + PM3Render2D_XPositive | + PM3Render2D_YPositive | + PM3Render2D_Operation_SyncOnBitMask; + pGlint->PM3_Config2D = + PM3Config2D_UserScissorEnable | + PM3Config2D_UseConstantSource | + PM3Config2D_ForegroundROPEnable | + PM3Config2D_ForegroundROP(rop) | + PM3Config2D_FBWriteEnable; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + if (bg != -1) { + REPLICATE(bg); + pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan; + GLINT_WAIT(8); + GLINT_WRITE_REG(bg, BackgroundColor); } - TRACE_EXIT("Permedia3WritePixmap"); + else GLINT_WAIT(7); + GLINT_WRITE_REG(fg, PM3ForegroundColor); + DO_PLANEMASK(planemask); + GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); + GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w) | PM3Render2D_Height(h), + PM3Render2D); + + while(h--) { + count = dwords; + srcp = (CARD32*)src; + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | + 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(count) { + GLINT_WAIT(count + 1); + GLINT_WRITE_REG(((count - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, count); + } + src += srcwidth; + } + + Permedia3DisableClipping(pScrn); + Permedia3Sync(pScrn); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c index 467d9674f..2cdcbbea4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>. + * Copyright 2000,2001 by Sven Luther <luther@dpt-info.u-strasbg.fr>. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,11 +21,12 @@ * * Authors: Sven Luther, <luther@dpt-info.u-strasbg.fr> * Thomas Witzel, <twitzel@nmr.mgh.harvard.edu> + * Alan Hourihane, <alanh@fairlite.demon.co.uk> * * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.8 2000/10/26 13:41:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.18 2001/02/05 10:44:58 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -50,104 +51,78 @@ # define TRACE(str) #endif -int PM3QuickFillMemory(ScrnInfoPtr pScrn,int size); - int -PM3QuickFillMemory(ScrnInfoPtr pScrn,int size) +Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR (pScrn); - unsigned int * p; - unsigned int p_content; - unsigned int i, j; - long savemapsize; - - savemapsize = pGlint->FbMapSize; - pGlint->FbMapSize = size*1024*1024; - - pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pGlint->PciTag, pGlint->FbAddress, pGlint->FbMapSize); - if (pGlint->FbBase == NULL) { - pGlint->FbMapSize = savemapsize; - return FALSE; - } + CARD32 size = 0, temp, temp1, temp2, i; - /* Set pointer to Aperture1 */ - p = (unsigned int *) pGlint->FbBase; - /* Fill in megs number of megabytes */ - for(i=0;i<size;i++) - for(j=0;j<1024*256;j+=1024) - p[j+(i*1024*256)] = j + (i * 1024*256); + /* We can map 64MB, as that's the size of the Permedia3 aperture + * regardless of memory configuration */ + pGlint->FbMapSize = 64*1024*1024; - /* Set pointer to Aperture1 */ - p = (unsigned int *) pGlint->FbBase; + /* Mark as VIDMEM_MMIO to avoid write-combining while detecting memory */ + pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pGlint->PciTag, pGlint->FbAddress, pGlint->FbMapSize); - /* If original ptr is 0x0 then no rollover occured */ - p_content = p[0]; - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, - pGlint->FbMapSize); - pGlint->FbBase = NULL; - pGlint->FbMapSize = savemapsize; - if (p_content == 0x0) - return TRUE; - else return FALSE; -} -int -Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) -{ - GLINTPtr pGlint; - int size = 1; - pGlint = GLINTPTR (pScrn); - /* Fill memory until get a rollover of dram to 0 - * fill in powers of 2, 1,2,4,8,16,32 + if (pGlint->FbBase == NULL) + return 0; + + temp = GLINT_READ_REG(PM3MemBypassWriteMask); + GLINT_SLOW_WRITE_REG(0xffffffff, PM3MemBypassWriteMask); + + /* The Permedia3 splits up memory, and even replicates it. Grrr. + * So that each 32MB appears at offset 0, and offset 32, unless + * there's really 64MB attached to the chip. + * So, 16MB appears at offset 0, nothing between 16-32, then it re-appears + * at offset 32. + * This below is to detect the cases of memory combinations + * It may also need closer examination for boards other than 16 or 32MB */ - while(PM3QuickFillMemory(pScrn,size)) - { - size = size*2; - if(size == 64) break; + + /* Test first 32MB */ + for(i=0;i<32;i++) { + /* write test pattern */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); + mem_barrier(); + temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); + /* Let's check for wrapover, write will fail at 16MB boundary */ + if (temp1 == (i*0x00345678)) + size = i; + else + break; } - /* Correct memory amount since fail */ - if (size != 1) - size = size / 2; - else - return 1*1024; - /* Just to make sure */ - if (PM3QuickFillMemory(pScrn,size)) - return size*1024; - return 16*1024; -} -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 128bit SGRAMs or SDRAMs */ - int logbytesperaccess = 4; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; + /* Ok, we're satisfied we've got 32MB, let's test the second lot */ + if (size == i) { + for(i=0;i<32;i++) { + /* Clear first 32MB */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, 0); + mem_barrier(); + } + for(i=32;i<64;i++) { + /* write test pattern */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); + mem_barrier(); + temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); + temp2 = MMIO_IN32(pGlint->FbBase, (i-32)*1024*1024); + /* Let's check for wrapover */ + if ( (temp1 == (i*0x00345678)) && (temp2 == 0) ) + size = i; + else + break; } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; } - return (value); + + GLINT_SLOW_WRITE_REG(temp, PM3MemBypassWriteMask); + + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, + pGlint->FbMapSize); + + pGlint->FbBase = NULL; + pGlint->FbMapSize = 0; + + return ( (size+1) * 1024 ); } static unsigned long @@ -188,18 +163,17 @@ void Permedia3PreInit(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR(pScrn); + TRACE_ENTER("Permedia3PreInit"); - if ((pGlint->PciInfo->subsysVendor == 0x1097) && - (pGlint->PciInfo->subsysCard == 0x3d32)) { + if (IS_J2000) { unsigned char m,n,p; unsigned long clockused; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Appian Jeronimo 2000 board detected and initialized.\n\t" - "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n", - pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); /* Memory timings for the Appian J2000 board. - * This is needed for the second head which is left unitilialized + * This is needed for the second head which is left un-initialized * by the bios, thus freezing the machine. */ GLINT_SLOW_WRITE_REG(0x02e311B8, PM3LocalMemCaps); GLINT_SLOW_WRITE_REG(0x07424905, PM3LocalMemTimings); @@ -231,98 +205,91 @@ Permedia3PreInit(ScrnInfoPtr pScrn) PM3RD_SClkControl_SOURCE_PCLK | PM3RD_SClkControl_ENABLE); } - else xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Unknown Glint Permedia3 board detected.\n\t" - "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n\t" - "Let's hope that it is correctly initialized by the bios.\n", - pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard); + TRACE_EXIT("Permedia3PreInit"); } Bool -Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode) +Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; CARD32 temp1, temp2, temp3, temp4; - pReg->glintRegs[PM3MemBypassWriteMask >> 3] = 0xffffffff; - pReg->glintRegs[PM3ByAperture1Mode >> 3] = 0x00000000; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = 0x00000000; - - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + STOREREG(GCSRAperture, GCSRSecondaryGLINTMapEn); + } - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; + if (pGlint->MultiAperture) { + STOREREG(GMultGLINTAperture, pGlint->realWidth); + STOREREG(GMultGLINT1, + pGlint->MultiPciInfo[0]->memBase[2] & 0xFF800000); + STOREREG(GMultGLINT2, + pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); } + STOREREG(PM3MemBypassWriteMask, 0xffffffff); + STOREREG(Aperture0, 0x00000000); + STOREREG(Aperture1, 0x00000000); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + STOREREG(DFIFODis, 0x00000001); + + STOREREG(FIFODis, 0x00000007); + temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; temp3 = mode->CrtcHSyncEnd - mode->CrtcHSyncStart; temp4 = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - pReg->glintRegs[PMHTotal >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); - pReg->glintRegs[PMHsEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); - pReg->glintRegs[PMHsStart >> 3] = Shiftbpp(pScrn, temp1); - pReg->glintRegs[PMHbEnd >> 3] = - Shiftbpp(pScrn,mode->CrtcHTotal-mode->CrtcHDisplay); - pReg->glintRegs[PMHgEnd >> 3] = pReg->glintRegs[PMHbEnd >> 3]; - pReg->glintRegs[PMScreenStride >> 3] = - Shiftbpp(pScrn,pScrn->displayWidth); - - pReg->glintRegs[PMVTotal >> 3] = mode->CrtcVTotal; - pReg->glintRegs[PMVsEnd >> 3] = temp2 + temp4; - pReg->glintRegs[PMVsStart >> 3] = temp2; - pReg->glintRegs[PMVbEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; - - pReg->glintRegs[PMHTotal >> 3] -= 1; - pReg->glintRegs[PMVTotal >> 3] -= 1; - pReg->glintRegs[PMVsStart >> 3] -= 1; - pReg->glintRegs[PMVsEnd >> 3] -= 1; - - /* The hw cursor needs /VSYNC to recognize vert retrace. We'll stick - both sync lines to active high here and if needed invert them - using the RAMDAC's RDSyncControl below. */ - /* We need to set the pixelsize (bit 19 & 20) also ... */ + STOREREG(PMHTotal, Shiftbpp(pScrn, mode->CrtcHTotal - 1)); + STOREREG(PMHsEnd, Shiftbpp(pScrn, temp1 + temp3)); + STOREREG(PMHsStart, Shiftbpp(pScrn, temp1)); + STOREREG(PMHbEnd, Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay)); + STOREREG(PMHgEnd, Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay)); + STOREREG(PMScreenStride, Shiftbpp(pScrn, pScrn->displayWidth)); + + STOREREG(PMVTotal, mode->CrtcVTotal - 1); + STOREREG(PMVsEnd, temp2 + temp4 - 1); + STOREREG(PMVsStart, temp2 - 1); + STOREREG(PMVbEnd, mode->CrtcVTotal - mode->CrtcVDisplay); + switch (pScrn->bitsPerPixel) { case 8: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_8BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_8BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (0 << 19); + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_8BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_8BIT); + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (0 << 19)); break; case 16: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_16BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_16BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (1 << 19); +#if X_BYTE_ORDER != X_BIG_ENDIAN + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_16BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_16BIT); +#else + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_16BIT | + PM3ByApertureMode_BYTESWAP_BADC); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_16BIT | + PM3ByApertureMode_BYTESWAP_BADC); +#endif + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (1 << 19)); break; case 32: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_32BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_32BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (2 << 19); +#if X_BYTE_ORDER != X_BIG_ENDIAN + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_32BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT); +#else + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | + PM3ByApertureMode_BYTESWAP_DCBA); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | + PM3ByApertureMode_BYTESWAP_DCBA); +#endif + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (2 << 19)); break; } - pReg->glintRegs[VClkCtl >> 3] = (GLINT_READ_REG(VClkCtl) & 0xFFFFFFFC); - pReg->glintRegs[PMScreenBase >> 3] = 0; + STOREREG(VClkCtl, GLINT_READ_REG(VClkCtl) & 0xFFFFFFFC); + STOREREG(PMScreenBase, 0x00000000); + STOREREG(ChipConfig, GLINT_READ_REG(ChipConfig) & 0xFFFFFFFD); - pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFDD; - pReg->DacRegs[PM2VDACRDDACControl] = 0x00; - { /* Get the programmable clock values */ unsigned char m,n,p; @@ -331,197 +298,274 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Let's program the dot clock */ clockused = PM3DAC_CalculateClock(mode->Clock, pGlint->RefClock, &m,&n,&p); - pReg->DacRegs[PM3RD_DClk0PreScale] = m; - pReg->DacRegs[PM3RD_DClk0FeedbackScale] = n; - pReg->DacRegs[PM3RD_DClk0PostScale] = p; + STOREDAC(PM3RD_DClk0PreScale, m); + STOREDAC(PM3RD_DClk0FeedbackScale, n); + STOREDAC(PM3RD_DClk0PostScale, p); } - pReg->DacRegs[PM2VDACRDIndexControl] = 0x00; - - if (pScrn->rgbBits == 8) - pReg->DacRegs[PM2VDACRDMiscControl] = 0x01; /* 8bit DAC */ - else - pReg->DacRegs[PM2VDACRDMiscControl] = 0x00; /* 6bit DAC */ - - pReg->DacRegs[PM2VDACRDSyncControl] = 0x00; - if (!(mode->Flags & V_PHSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ - if (!(mode->Flags & V_PVSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ - + temp1 = 0; + temp2 = 0; #if 0 /* Currently commented out while testing Flat Panel support */ - pReg->DacRegs[PM2VDACRDDACControl] = 0x01; - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x40; - pReg->glintRegs[VSConfiguration >> 3] = (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06; - pReg->glintRegs[VSBBase >> 3] = 1<<14; + temp1 |= 0x40; + temp2 |= 0x01; + STOREREG(VSConfiguration, + (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06)); + STOREREG(VSBBase, 1<<14); #endif + if (mode->Flags & V_PHSYNC) temp1 |= 0x01; /* invert hsync */ + if (mode->Flags & V_PVSYNC) temp1 |= 0x08; /* invert vsync */ + + STOREDAC(PM2VDACRDIndexControl, 0x00); + STOREDAC(PM2VDACRDSyncControl, temp1); + STOREDAC(PM2VDACRDDACControl, 0x00); + + temp3 = 0; + if (pScrn->rgbBits == 8) + temp3 |= 0x01; /* 8bit DAC */ switch (pScrn->bitsPerPixel) { case 8: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x00; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x2E; + STOREDAC(PM2VDACRDPixelSize, 0x00); + STOREDAC(PM2VDACRDColorFormat, 0x2E); break; case 16: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x01; - if (pScrn->depth == 15) - pReg->DacRegs[PM2VDACRDColorFormat] = 0x61; - else - pReg->DacRegs[PM2VDACRDColorFormat] = 0x70; + STOREDAC(PM2VDACRDPixelSize, 0x01); + if (pScrn->depth == 15) { + STOREDAC(PM2VDACRDColorFormat, 0x61); + } else { + STOREDAC(PM2VDACRDColorFormat, 0x70); + } break; case 24: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x04; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x60; + STOREDAC(PM2VDACRDPixelSize, 0x04); + STOREDAC(PM2VDACRDColorFormat, 0x60); break; case 32: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x02; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x20; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - pReg->DacRegs[PM2VDACRDMiscControl] |= 0x10; - pReg->DacRegs[PM2VDACRDOverlayKey] = pScrn->colorKey; + temp3 |= 0x18; + STOREDAC(PM2VDACRDOverlayKey, pScrn->colorKey); } + STOREDAC(PM2VDACRDPixelSize, 0x02); + STOREDAC(PM2VDACRDColorFormat, 0x20); break; } + STOREDAC(PM2VDACRDMiscControl, temp3); return(TRUE); } void -Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); int i; + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information */ + memcpy((CARD8*)pGlint->VGAdata,(CARD8*)pGlint->FbBase, 65536); + + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + SAVEREG(GCSRAperture); + } + + if (pGlint->MultiAperture) { + SAVEREG(GMultGLINTAperture); + SAVEREG(GMultGLINT1); + SAVEREG(GMultGLINT2); + } + /* Permedia 3 memory Timings */ - glintReg->glintRegs[PM3MemBypassWriteMask >> 3] = - GLINT_READ_REG(PM3MemBypassWriteMask); - glintReg->glintRegs[PM3ByAperture1Mode >> 3] = - GLINT_READ_REG(PM3ByAperture1Mode); - glintReg->glintRegs[PM3ByAperture2Mode >> 3] = - GLINT_READ_REG(PM3ByAperture2Mode); - - glintReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig); - glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); - glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); - - glintReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis); - glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); - glintReg->glintRegs[PMHTotal >> 3] = GLINT_READ_REG(PMHTotal); - glintReg->glintRegs[PMHbEnd >> 3] = GLINT_READ_REG(PMHbEnd); - glintReg->glintRegs[PMHbEnd >> 3] = GLINT_READ_REG(PMHgEnd); - glintReg->glintRegs[PMScreenStride >> 3] = GLINT_READ_REG(PMScreenStride); - glintReg->glintRegs[PMHsStart >> 3] = GLINT_READ_REG(PMHsStart); - glintReg->glintRegs[PMHsEnd >> 3] = GLINT_READ_REG(PMHsEnd); - glintReg->glintRegs[PMVTotal >> 3] = GLINT_READ_REG(PMVTotal); - glintReg->glintRegs[PMVbEnd >> 3] = GLINT_READ_REG(PMVbEnd); - glintReg->glintRegs[PMVsStart >> 3] = GLINT_READ_REG(PMVsStart); - glintReg->glintRegs[PMVsEnd >> 3] = GLINT_READ_REG(PMVsEnd); - glintReg->glintRegs[PMScreenBase >> 3] = GLINT_READ_REG(PMScreenBase); - glintReg->glintRegs[PMVideoControl >> 3] = GLINT_READ_REG(PMVideoControl); - glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); + SAVEREG(PM3MemBypassWriteMask); + SAVEREG(PM3ByAperture1Mode); + SAVEREG(PM3ByAperture2Mode); + SAVEREG(ChipConfig); + SAVEREG(Aperture0); + SAVEREG(Aperture1); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + SAVEREG(DFIFODis); + SAVEREG(FIFODis); + SAVEREG(PMHTotal); + SAVEREG(PMHbEnd); + SAVEREG(PMHgEnd); + SAVEREG(PMScreenStride); + SAVEREG(PMHsStart); + SAVEREG(PMHsEnd); + SAVEREG(PMVTotal); + SAVEREG(PMVbEnd); + SAVEREG(PMVsStart); + SAVEREG(PMVsEnd); + SAVEREG(PMScreenBase); + SAVEREG(PMVideoControl); + SAVEREG(VClkCtl); #if 0 /* Currently commented out while testing Flat Panel support */ - glintReg->glintRegs[VSConfiguration >> 3] = GLINT_READ_REG(VSConfiguration); - glintReg->glintRegs[VSBBase >> 3] = GLINT_READ_REG(VSBBase); + SAVEREG(VSConfiguration); + SAVEREG(VSBBase); #endif for (i=0;i<768;i++) { Permedia2ReadAddress(pScrn, i); - glintReg->cmap[i] = Permedia2ReadData(pScrn); + pReg->cmap[i] = Permedia2ReadData(pScrn); } - glintReg->DacRegs[PM2VDACRDIndexControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDIndexControl); - glintReg->DacRegs[PM2VDACRDOverlayKey] = - Permedia2vInIndReg(pScrn, PM2VDACRDOverlayKey); - glintReg->DacRegs[PM2VDACRDSyncControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDSyncControl); - glintReg->DacRegs[PM2VDACRDMiscControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDMiscControl); - glintReg->DacRegs[PM2VDACRDDACControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDDACControl); - glintReg->DacRegs[PM2VDACRDPixelSize] = - Permedia2vInIndReg(pScrn, PM2VDACRDPixelSize); - glintReg->DacRegs[PM2VDACRDColorFormat] = - Permedia2vInIndReg(pScrn, PM2VDACRDColorFormat); - - glintReg->DacRegs[PM2VDACRDDClk0PreScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PreScale); - glintReg->DacRegs[PM2VDACRDDClk0FeedbackScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0FeedbackScale); - glintReg->DacRegs[PM2VDACRDDClk0PostScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PostScale); + P2VIN(PM2VDACRDIndexControl); + P2VIN(PM2VDACRDOverlayKey); + P2VIN(PM2VDACRDSyncControl); + P2VIN(PM2VDACRDMiscControl); + P2VIN(PM2VDACRDDACControl); + P2VIN(PM2VDACRDPixelSize); + P2VIN(PM2VDACRDColorFormat); + P2VIN(PM2VDACRDDClk0PreScale); + P2VIN(PM2VDACRDDClk0FeedbackScale); + P2VIN(PM2VDACRDDClk0PostScale); } void -Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); CARD32 temp; int i; -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information */ + if (pGlint->STATE) + memcpy((CARD8*)pGlint->FbBase,(CARD8*)pGlint->VGAdata, 65536); + + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + RESTOREREG(GCSRAperture); + } + + if (pGlint->MultiAperture) { + RESTOREREG(GMultGLINTAperture); + RESTOREREG(GMultGLINT1); + RESTOREREG(GMultGLINT2); + } /* Permedia 3 memory Timings */ - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3MemBypassWriteMask >> 3], - PM3MemBypassWriteMask); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture1Mode >> 3], - PM3ByAperture1Mode); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture2Mode >> 3], - PM3ByAperture2Mode); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[ChipConfig >> 3], ChipConfig); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVideoControl >> 3], - PMVideoControl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHbEnd >> 3], PMHgEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenBase >> 3], PMScreenBase); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VClkCtl >> 3], VClkCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenStride >> 3], - PMScreenStride); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHTotal >> 3], PMHTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHbEnd >> 3], PMHbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsStart >> 3], PMHsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsEnd >> 3], PMHsEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVTotal >> 3], PMVTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVbEnd >> 3], PMVbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd); + RESTOREREG(PM3MemBypassWriteMask); + RESTOREREG(PM3ByAperture1Mode); + RESTOREREG(PM3ByAperture2Mode); + RESTOREREG(ChipConfig); + RESTOREREG(Aperture0); + RESTOREREG(Aperture1); + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + RESTOREREG(DFIFODis); + RESTOREREG(FIFODis); + RESTOREREG(PMVideoControl); + RESTOREREG(PMHbEnd); + RESTOREREG(PMHgEnd); + RESTOREREG(PMScreenBase); + RESTOREREG(VClkCtl); + RESTOREREG(PMScreenStride); + RESTOREREG(PMHTotal); + RESTOREREG(PMHsStart); + RESTOREREG(PMHsEnd); + RESTOREREG(PMVTotal); + RESTOREREG(PMVbEnd); + RESTOREREG(PMVsStart); + RESTOREREG(PMVsEnd); + #if 0 /* Currently commented out while testing Flat Panel support */ - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSConfiguration >> 3], VSConfiguration); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSBBase >> 3], VSBBase); + RESTOREREG(VSConfiguration); + RESTOREREG(VSBBase); #endif - Permedia2vOutIndReg(pScrn, PM2VDACRDIndexControl, 0x00, - glintReg->DacRegs[PM2VDACRDIndexControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDOverlayKey, 0x00, - glintReg->DacRegs[PM2VDACRDOverlayKey]); - Permedia2vOutIndReg(pScrn, PM2VDACRDSyncControl, 0x00, - glintReg->DacRegs[PM2VDACRDSyncControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDMiscControl, 0x00, - glintReg->DacRegs[PM2VDACRDMiscControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDACControl, 0x00, - glintReg->DacRegs[PM2VDACRDDACControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDPixelSize, 0x00, - glintReg->DacRegs[PM2VDACRDPixelSize]); - Permedia2vOutIndReg(pScrn, PM2VDACRDColorFormat, 0x00, - glintReg->DacRegs[PM2VDACRDColorFormat]); + P2VOUT(PM2VDACRDIndexControl); + P2VOUT(PM2VDACRDOverlayKey); + P2VOUT(PM2VDACRDSyncControl); + P2VOUT(PM2VDACRDMiscControl); + P2VOUT(PM2VDACRDDACControl); + P2VOUT(PM2VDACRDPixelSize); + P2VOUT(PM2VDACRDColorFormat); for (i=0;i<768;i++) { Permedia2WriteAddress(pScrn, i); - Permedia2WriteData(pScrn, glintReg->cmap[i]); + Permedia2WriteData(pScrn, pReg->cmap[i]); } temp = Permedia2vInIndReg(pScrn, PM2VDACIndexClockControl) & 0xFC; - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PreScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0PreScale]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0FeedbackScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0FeedbackScale]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PostScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0PostScale]); + P2VOUT(PM2VDACRDDClk0PreScale); + P2VOUT(PM2VDACRDDClk0FeedbackScale); + P2VOUT(PM2VDACRDDClk0PostScale); Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03); } + +void Permedia3LoadPalette( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ +#if 0 /* NOT YET */ + GLINTPtr pGlint = GLINTPTR(pScrn); +#endif + int i, index, shift = 0, j, repeat = 1; + + if (pScrn->depth == 15) { + repeat = 8; + shift = 3; + } + + for(i = 0; i < numColors; i++) { + index = indices[i]; + for (j = 0; j < repeat; j++) { + Permedia2WriteAddress(pScrn, (index << shift)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index].blue); + } + /* for video i/o */ +#if 0 /* NOT YET */ + GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); + GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | + ((colors[index].green & 0xFF) << 8) | + ((colors[index].blue & 0xFF) << 16), + PM3LUTData); +#endif + } +} + +/* special one for 565 mode */ +void Permedia3LoadPalette16( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ +#if 0 /* NOT YET */ + GLINTPtr pGlint = GLINTPTR(pScrn); +#endif + int i, index, j; + + for(i = 0; i < numColors; i++) { + index = indices[i]; + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 2)+j); + Permedia2WriteData(pScrn, colors[index >> 1].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index >> 1].blue); + } +#if 0 /* NOT YET */ + GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); + GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | + ((colors[index].green & 0xFF) << 8) | + ((colors[index].blue & 0xFF) << 16), + PM3LUTData); +#endif + + if(index <= 31) { + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 3)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[(index << 1) + 1].green); + Permedia2WriteData(pScrn, colors[index].blue); + } + } + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h index ed455edd9..42946b213 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.3 2000/10/17 09:07:05 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.4 2001/01/31 16:15:02 alanh Exp $ */ /* * glint register file @@ -698,7 +698,7 @@ #define PM3LUT 0x8e80 #define PM3LUTAddress 0x84d0 #define PM3LUTData 0x84c8 -#define PM3LUTIndex 0x64c0 +#define PM3LUTIndex 0x84c0 #define PM3LUTMode 0xb378 #define PM3LUTModeAnd 0xad70 #define PM3LUTModeOr 0xad78 @@ -955,11 +955,6 @@ #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) -/********************************************** -* GLINT Permedia3 Tags and other stuff * -***********************************************/ -#define PM3SyncTag 0x0188 - #if 0 /********************************************** @@ -986,16 +981,6 @@ WRITE_REG(base,offset,temp&(~(val))); \ } -#if 0 /* Old Xfree code ... */ -#define WAIT(n) \ -do{ \ - if(!pGlint->UsePCIRetry) \ - while(READ_REG(InFIFOSpace)<(n)){ \ - mem_barrier(); \ - } \ -}while(0) -#endif - #define RAMDAC_DELAY(b,x) do { \ int delay = x; \ unsigned char tmp; \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c index 2f08ac36d..1909ffada 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * * GLINT 500TX / MX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.22 2000/05/10 20:01:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.25 2001/02/07 13:26:21 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -47,6 +47,7 @@ #include "xaalocal.h" /* For replacements */ static void TXSync(ScrnInfoPtr pScrn); +static void DualTXSync(ScrnInfoPtr pScrn); static void TXSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void TXSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, @@ -74,10 +75,6 @@ static void TXWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int trans, int bpp, int depth); -static void TXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void TXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); static void TXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void TXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, @@ -104,9 +101,30 @@ TXInitializeEngine(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR(pScrn); /* Initialize the Accelerator Engine to defaults */ + pGlint->rasterizerMode = UNIT_DISABLE; + + if (pGlint->MultiAperture) { + pGlint->rasterizerMode = RMMultiGLINT; + + /* Only write the following register to the first chip */ + GLINT_SLOW_WRITE_REG(1, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); + + /* Only write the following register to the second chip */ + GLINT_SLOW_WRITE_REG(2, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); + + /* Make sure the rest of the register writes go to both chip's */ + GLINT_SLOW_WRITE_REG(3, BroadcastMask); + GLINT_SLOW_WRITE_REG(pGlint->pprod | LBRM_ScanlineInt2, LBReadMode); + pGlint->pprod |= FBRM_ScanlineInt2; + } else { + GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); + } + + GLINT_SLOW_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); - GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); GLINT_SLOW_WRITE_REG(pGlint->pprod, FBReadMode); GLINT_SLOW_WRITE_REG(0, dXSub); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWriteMode); @@ -134,7 +152,6 @@ TXInitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset); @@ -192,7 +209,10 @@ TXAccelInit(ScreenPtr pScreen) LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - infoPtr->Sync = TXSync; + if (pGlint->MultiAperture) + infoPtr->Sync = DualTXSync; + else + infoPtr->Sync = TXSync; infoPtr->SetClippingRectangle = TXSetClippingRectangle; infoPtr->DisableClipping = TXDisableClipping; @@ -217,10 +237,12 @@ TXAccelInit(ScreenPtr pScreen) infoPtr->PolySegmentThinSolid = TXPolySegmentThinSolidWrapper; infoPtr->PolylinesThinSolid = TXPolylinesThinSolidWrapper; - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | - ONLY_LEFT_TO_RIGHT_BITBLT; - infoPtr->SetupForScreenToScreenCopy = TXSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = TXSubsequentScreenToScreenCopy; + if (!pGlint->MultiAperture) { + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | + ONLY_LEFT_TO_RIGHT_BITBLT; + infoPtr->SetupForScreenToScreenCopy = TXSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = TXSubsequentScreenToScreenCopy; + } infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_ORIGIN | HARDWARE_PATTERN_SCREEN_ORIGIN | @@ -228,37 +250,25 @@ TXAccelInit(ScreenPtr pScreen) infoPtr->SetupForMono8x8PatternFill = TXSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = TXSubsequentMono8x8PatternFillRect; - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | BIT_ORDER_IN_BYTE_LSBFIRST; - pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->XAAScanlineColorExpandBuffers[0] = xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = + pGlint->XAAScanlineColorExpandBuffers[1] = xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 2; + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = TXSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = TXSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = TXSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | - SYNC_AFTER_COLOR_EXPAND | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - TXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - TXSubsequentCPUToScreenColorExpandFill; - } infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; @@ -312,42 +322,20 @@ static void TXLoadCoord( } #else GLINT_WRITE_REG(w<<16, StartXSub); - pGlint->startxsub = w; GLINT_WRITE_REG(x<<16,StartXDom); - pGlint->startxdom = x; GLINT_WRITE_REG(y<<16,StartY); - pGlint->starty = y; GLINT_WRITE_REG(h,GLINTCount); - pGlint->count = h; GLINT_WRITE_REG(a<<16,dXDom); - pGlint->dxdom = a; GLINT_WRITE_REG(d<<16,dY); + pGlint->startxsub = w; + pGlint->startxdom = x; + pGlint->starty = y; + pGlint->count = h; + pGlint->dxdom = a; pGlint->dy = d; #endif } -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - static void TXSync( ScrnInfoPtr pScrn @@ -363,12 +351,46 @@ TXSync( GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 readValue = GLINT_READ_REG(OutputFIFO); } while (readValue != Sync_tag); } static void +DualTXSync( + ScrnInfoPtr pScrn +){ + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned long readValue; + + CHECKCLIPPING; + + while (GLINT_READ_REG(DMACount) != 0); + GLINT_WAIT(3); + + /* hack! this shouldn't need to be reloaded */ + GLINT_WRITE_REG(3, BroadcastMask); + GLINT_WRITE_REG(0x400, FilterMode); + GLINT_WRITE_REG(0, GlintSync); + + /* Read 1st MX until Sync Tag shows */ + ACCESSCHIP1(); + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + readValue = GLINT_READ_REG(OutputFIFO); + } while (readValue != Sync_tag); + + ACCESSCHIP2(); + /* Read 2nd MX until Sync Tag shows */ + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + readValue = GLINT_READ_REG(OutputFIFO); + } while (readValue != Sync_tag); + + ACCESSCHIP1(); +} + + +static void TXSetupForFillRectSolid( ScrnInfoPtr pScrn, int color, int rop, @@ -492,7 +514,7 @@ TXSetupForScanlineCPUToScreenColorExpandFill( REPLICATE(bg); GLINT_WAIT(6); DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); if (rop == GXcopy) { GLINT_WRITE_REG(pGlint->pprod, FBReadMode); GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); @@ -541,7 +563,8 @@ TXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) while (dwords >= infoRec->ColorExpandRange) { GLINT_WAIT(infoRec->ColorExpandRange); GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, infoRec->ColorExpandRange - 1); dwords -= (infoRec->ColorExpandRange - 1); src += (infoRec->ColorExpandRange - 1); @@ -549,51 +572,12 @@ TXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) if (dwords) { GLINT_WAIT(dwords); GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); } pGlint->cpucount += 1; } -static void -TXSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(fg, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(fg, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); -} - -static void -TXSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - - TXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); -} - void TXSetupForMono8x8PatternFill( ScrnInfoPtr pScrn, int patternx, int patterny, @@ -696,7 +680,7 @@ TXWriteBitmap(ScrnInfoPtr pScrn, GLINT_WAIT(11); DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); LOADROP(rop); if (rop == GXcopy) { mode = 0; @@ -775,7 +759,7 @@ SECOND_PASS: SecondPass = FALSE; REPLICATE(bg); GLINT_WAIT(4); - GLINT_WRITE_REG(InvertBitMask, RasterizerMode); + GLINT_WRITE_REG(InvertBitMask | pGlint->rasterizerMode, RasterizerMode); if (rop == GXcopy) { GLINT_WRITE_REG(bg, FBBlockColor); } else { @@ -785,7 +769,7 @@ SECOND_PASS: } GLINT_WAIT(2); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); CHECKCLIPPING; SET_SYNC_FLAG(infoRec); } @@ -848,7 +832,8 @@ TXWritePixmap( /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; srcp += infoRec->ColorExpandRange - 1; @@ -858,7 +843,8 @@ TXWritePixmap( /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile index ff5cdf85f..30bd22e5e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.3 2000/12/11 01:53:00 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.4 2001/01/24 00:06:19 dawes Exp $ XCOMM XCOMM This is the Imakefile for the I128 driver. XCOMM @@ -36,7 +36,6 @@ ObjectModuleTarget(i128,$(OBJS)) InstallObjectModule(i128,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(i128,) InstallModuleManPage(i128) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp deleted file mode 100644 index 48926990f..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp +++ /dev/null @@ -1,70 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp,v 1.2 2000/12/11 20:18:14 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I128 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i128 \- Number 9 I128 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi128\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i128 -is an XFree86 driver for Number 9 I128 video cards. The driver is -accelerated and provides support for all versions of the I128 chip family, -including the SGI flatpanel configuration. Multi-head configurations are -supported. -.SH SUPPORTED HARDWARE -The -.B i128 -driver supports PCI and AGP video cards based on the following I128 chips: -.TP 12 -.B I128 rev 1 -(original) -.TP 12 -.B I128-II -.TP 12 -.B I128-T2R -Ticket 2 Ride -.TP 12 -.B I128-T2R4 -Ticket 2 Ride IV -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type and may not be overridden. -.PP -The driver auto-detects the amount of video memory present for all -chips and may not be overridden. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option \*qDac6Bit\*q \*q" boolean \*q -Reduce DAC operations to 6 bits. -Default: false. -.TP -.BI "Option \*qDebug\*q \*q" boolean \*q -This turns on verbose debug information from the driver. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Robin Cutshaw (driver), Galen Brooks (flatpanel support). diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c index af1800868..4ce35cb0a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.17 2000/12/11 01:53:01 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.18 2001/01/21 21:19:26 tsi Exp $ */ /* All drivers should typically include these */ @@ -86,11 +86,9 @@ static Bool I128SaveScreen(ScreenPtr pScreen, int mode); static void I128FreeScreen(int scrnIndex, int flags); static int I128ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* Internally used functions */ static Bool I128GetRec(ScrnInfoPtr pScrn); @@ -188,9 +186,7 @@ static const char *vgahwSymbols[] = { static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -1158,10 +1154,7 @@ I128PreInit(ScrnInfoPtr pScrn, int flags) I128FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); /* Load XAA if needed */ if (!pI128->NoAccel) { @@ -1536,9 +1529,7 @@ I128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!ret) return FALSE; -#ifdef RENDER fbPictureInit(pScreen, 0, 0); -#endif if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1603,9 +1594,7 @@ I128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; -#ifdef DPMSExtension xf86DPMSInit(pScreen, I128DisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = (unsigned long)pI128->MemoryPtr; pScrn->fbOffset = 0; @@ -1980,7 +1969,6 @@ I128getDDC(ScrnInfoPtr pScrn) * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension void I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2019,8 +2007,6 @@ I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, pI128->mem.rbase_g[DATA_I] = snc; MB; } -#endif - void I128DumpBaseRegisters(ScrnInfoPtr pScrn) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp deleted file mode 100644 index b3d4c9438..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp,v 1.5 2000/12/11 20:18:15 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I740 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i740 \- Intel i740 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi740\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i740 -is an XFree86 driver for Intel i740 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B i740 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile index 661c7000e..22ea98c08 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.13 2000/09/20 00:09:21 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.14 2001/01/24 00:06:20 dawes Exp $ XCOMM XCOMM This is the Imakefile for the i810 driver. XCOMM @@ -47,7 +47,6 @@ ObjectModuleTarget(i810,$(OBJS)) InstallObjectModule(i810,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(i810,) InstallModuleManPage(i810) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp deleted file mode 100644 index 17ab9429c..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp +++ /dev/null @@ -1,71 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp,v 1.6 2000/12/11 20:18:17 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I810 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i810 \- Intel i810 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi810\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i810 -is an XFree86 driver for the Intel i810 family of graphics chipsets. -The driver supports depths 8, 15, 16 and 24. All visual types are -supported in depth 8, other depths only support TrueColor. The driver -supports hardware accelerated 3D via the Direct Rendering Infrastructure (DRI), -but only in depth 16. -.SH SUPPORTED HARDWARE -.B i810 -supports the i810, i810-DC100, i810e and i815 chipsets. - -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The i810 has a unified memory architecture and uses system memory -for video ram. By default 8 Megabytes of system memory are used -for graphics. This amount may be changed with the -.B VideoRam -entry in the config file -.B "Device" -section. It may be set to any power of two between 4 and 32 Megabytes -inclusive to allow the user to customize the balance between main -memory usage and graphics performance. Too little memory reserved for -graphics can result in decreased 3D and 2D graphics performance and -features. -.PP -The following driver -.B Options -are supported -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disable or enable software cursor. Default: software cursor is disable -and a hardware cursor is used. -.TP -.BI "Option \*qColorKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -Default: undefined. -.TP -.BI "Option \*qCacheLines\*q \*q" integer \*q -This allows the user to change the amount of graphics memory used for -2D acceleration and video. Decreasing this amount leaves more for 3D -textures. Increasing it can improve 2D performance at the expense of -3D performance. -Default: 256 to 768 depending on the resolution and depth. - - - -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Keith Whitwell, and also Jonathan Bian, Matthew J Sottek, -Jeff Hartmann, Mark Vojkovich, Alan Hourihane, H. J. Lu. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c index 03ec81480..c8c1d34cf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.13 2000/12/01 14:28:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.14 2000/12/21 12:22:56 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c index 5f9416924..985ff3f10 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.39 2000/12/02 15:30:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.43 2001/01/21 21:19:27 tsi Exp $ */ /* * Authors: @@ -84,15 +84,13 @@ static void I810FreeScreen(int scrnIndex, int flags); static int I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#endif DriverRec I810 = { I810_VERSION, - "Accelerated driver for Intel i810 cards", + I810_DRIVER_NAME, I810Identify, I810Probe, I810AvailableOptions, @@ -158,12 +156,16 @@ static const char *fbSymbols[] = { NULL }; - static const char *miscSymbols[] = { "GetTimeInMillis", NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + NULL +}; static const char *xaaSymbols[] = { "XAADestroyInfoRec", @@ -290,6 +292,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) drmSymbols, driSymbols, #endif + vbeSymbols, NULL /* ddcsymbols */, NULL /* i2csymbols */, NULL /* shadowSymbols */, @@ -1644,6 +1647,9 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; } + if (!miSetPixmapDepths ()) + return FALSE; + { I810RegPtr i810Reg = &pI810->ModeReg; int i; @@ -1717,6 +1723,8 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } } + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); #ifdef XF86DRI @@ -1785,9 +1793,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; #endif -#ifdef DPMSExtension xf86DPMSInit(pScreen, I810DisplayPowerManagementSet, 0); -#endif I810InitVideo(pScreen); @@ -2012,7 +2018,6 @@ I810SaveScreen(ScreenPtr pScreen, Bool unblack) return vgaHWSaveScreen(pScreen, unblack); } -#ifdef DPMSExtension static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -2051,10 +2056,3 @@ I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, /* Set the DPMS mode */ OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); } -#endif - - - - - - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c index 35daecb8c..b1ab66cb0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c @@ -23,7 +23,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.14 2000/12/06 01:40:49 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.16 2001/01/30 19:23:55 mvojkovi Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. @@ -31,10 +31,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Jonathan Bian <jonathan.bian@intel.com> * - * Notes: - * This module currently allocates 810*2KB out of "SysMem" for the YUV - * buffers. This may not be the best solution ... - * */ #include "xf86.h" @@ -133,6 +129,9 @@ static Atom xvBrightness, xvContrast, xvColorKey; #define BUFFER1_FIELD0 0x00000004 #define OVERLAY_ENABLE 0x00000001 +#define UV_VERT_BUF1 0x02 +#define UV_VERT_BUF0 0x04 + /* * DOV0STA - Display/Overlay 0 Status Register */ @@ -600,6 +599,9 @@ I810QueryBestSize( unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 1)) drw_w = vid_w >> 1; + if(vid_h > (drw_h << 1)) drw_h = vid_h >> 1; + *p_w = drw_w; *p_h = drw_h; } @@ -856,6 +858,9 @@ I810DisplayVideo( switch(id) { case FOURCC_YV12: case FOURCC_I420: + /* set UV vertical phase to -0.25 */ + overlay->UV_VPH = 0x30003000; + overlay->INIT_PH = UV_VERT_BUF0 | UV_VERT_BUF1; overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16); overlay->OV0CMD &= ~SOURCE_FORMAT; overlay->OV0CMD |= YUV_420; @@ -863,6 +868,8 @@ I810DisplayVideo( case FOURCC_UYVY: case FOURCC_YUY2: default: + overlay->UV_VPH = 0; + overlay->INIT_PH = 0; overlay->OV0STRIDE = dstPitch; overlay->OV0CMD &= ~SOURCE_FORMAT; overlay->OV0CMD |= YUV_422; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile index a2f771acb..313ed5002 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.3 2000/10/11 16:21:21 mvojkovi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.4 2001/01/24 00:06:20 dawes Exp $ /* * * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -39,7 +39,6 @@ ObjectModuleTarget(imstt, $(OBJS)) InstallObjectModule(imstt,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(imstt,) InstallModuleManPage(imstt) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp deleted file mode 100644 index 1a7b51245..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp,v 1.3 2000/12/11 20:18:18 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH IMSTT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -imstt \- Integrated Micro Solutions Twin Turbo 128 driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qimstt\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B imstt -is an XFree86 driver for Integrated Micro Solutions Twin Turbo 128 video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B imstt -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile index 9aadb83c2..958906fa6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.39 2000/12/14 16:38:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.41 2001/02/13 19:19:15 dawes Exp $ XCOMM XCOMM This is an Imakefile for the MGA driver. XCOMM @@ -57,10 +57,10 @@ hallib/libmga_hal.a: $(SUBDIRS) MGASRCS = mga_driver.c mga_hwcurs.c /* mga_cmap.c */ mga_dac3026.c mga_dacG.c \ mga_storm8.c mga_storm16.c mga_storm24.c mga_storm32.c mga_arc.c \ - mga_dga.c mga_shadow.c mga_video.c $(DRISRCS) + mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c $(DRISRCS) MGAOBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \ mga_storm8.o mga_storm16.o mga_storm24.o mga_storm32.o mga_arc.o \ - mga_dga.o mga_shadow.o mga_video.o $(DRIOBJS) + mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o $(DRIOBJS) SRCS = $(MGASRCS) $(MGAHALSRCS) OBJS = $(MGAOBJS) $(MGAHALOBJS) @@ -109,7 +109,6 @@ InstallObjectModule(mga_hal,$(MODULEDIR),drivers) #endif #if !defined(XF86DriverSDK) -CppManTarget(mga,) InstallModuleManPage(mga) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp deleted file mode 100644 index 9711e40d1..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp +++ /dev/null @@ -1,122 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp,v 1.9 1999/08/28 10:43:36 dawes Exp $ -.TH MGA __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -mga \- Matrox video driver -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""mga""" -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B mga -is an XFree86 driver for Matrox video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 15, 16, 24, and an 8+24 overlay mode (all chips except G100). All -visual types are supported for depth 8, and both TrueColor and DirectColor -visuals are supported for the other depths except 8+24 mode which supports -PseudoColor, GrayScale and TrueColor. Multi-head configurations -are supported. -.SH SUPPORTED HARDWARE -The -.B mga -driver supports PCI and AGP video cards based on the following Matrox chips: -.TP 12 -.B MGA2064W -Millennium (original) -.TP 12 -.B MGA1064SG -Mystique -.TP 12 -.B MGA2164W -Millennium II -.TP 12 -.B G100 -.TP 12 -.B G200 -Millennium G200 and Mystique G200 -.TP 12 -.B G400 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B """Device""" -section, and will override the auto-detection: -.PP -.RS 4 -"mga2064w", "mga1064sg", "mga2164w", "mga2164w agp", "mgag100", "mgag200", -"mgag200 pci" "mgag400". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chips except the Millennium II. In the Millennium II case it defaults -to 4096\ kBytes. When using a Millennium II, the actual amount of video -memory should be specified with a -.B VideoRam -entry in the config file -.B """Device""" -section. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option ""ColorKey"" """ integer """ -Set the colormap index used for the transparency key for the depth 8 plane -when operating in 8+24 overlay mode. The value must be in the range -2\-255. Default: 255. -.TP -.BI "Option ""HWCursor"" """ boolean """ -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option ""MGASDRAM"" """ boolean """ -Specify whether G100 and G200 cards have SDRAM. The driver attempts to -auto-detect this based on the card's PCI subsystem ID. This option may -be used to override that auto-detection. Default: auto-detected. -.TP -.BI "Option ""NoAccel"" """ boolean """ -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option ""OverclockMem"" -Set clocks to values used by some commercial X-Servers (G100, G200 and G400 -only). Default: off. -.TP -.BI "Option ""Overlay"" -Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off. -.TP -.BI "Option ""PciRetry"" """ boolean """ -Enable or disable PCI retries. Default: off. -.TP -.BI "Option ""Rotate"" ""CW"" -.TP -.BI "Option ""Rotate"" ""CCW"" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.BI "Option ""ShadowFB"" """ boolean """ -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option ""SyncOnGreen"" """ boolean """ -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option ""UseFBDev"" """ boolean """ -Enable or disable use of on OS-specific fb interface (and is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1) -.SH AUTHORS -Authors include: Radoslaw Kapitan, Mark Vojkovich, and also David Dawes, Guy -Desbief, Dirk Hohndel, Doug Merritt, Andrew E. Mileski, Andrew Vanderstock, -Leonard N. Zubkoff. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index 1881ab7ad..3e6336a32 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.70 2000/12/06 15:35:19 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.71 2001/02/13 19:19:15 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -432,4 +432,5 @@ Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); #endif +double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c index 3f74af156..2d5361f9b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c @@ -2,7 +2,7 @@ * MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.42 2000/12/06 15:35:20 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.43 2001/02/13 19:19:15 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -237,6 +237,11 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out ) /* The actual frequency output by the clock */ double f_pll; + if(MGAISG450(pMga)) { + G450SetPLLFreq(pScrn, f_out); + return; + } + /* Do the calculations for m, n, p and s */ f_pll = MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); @@ -338,6 +343,9 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #ifdef USEMGAHAL MGA_HAL(break;); #endif + if (MGAISG450(pMga)) + break; + if(pMga->Dac.maxPixelClock == 360000) { /* G400 MAX */ if(pMga->OverclockMem) { /* 150/200 */ @@ -379,7 +387,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case PCI_CHIP_MGAG200_PCI: default: #ifdef USEMGAHAL - MGA_HAL(break;); + MGA_HAL(break;); #endif if(pMga->OverclockMem) { /* 143 Mhz */ @@ -528,6 +536,10 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (mode->Flags & V_DBLSCAN) pVga->CRTC[9] |= 0x80; + if(MGAISG450(pMga)) { + OUTREG(MGAREG_ZORG, 0); + } + MGAGSetPCLK(pScrn, mode->Clock); ); /* MGA_NOT_HAL */ @@ -656,7 +668,10 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, (i == 0x1b) || (i == 0x1c) || ((i >= 0x1f) && (i <= 0x29)) || - ((i >= 0x30) && (i <= 0x37)) ) + ((i >= 0x30) && (i <= 0x37)) || + (MGAISG450(pMga) && + ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || + (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) continue; outMGAdac(i, mgaReg->DacRegs[i]); } @@ -665,15 +680,17 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, should be correct already */ optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; - /* restore pci_option register */ - pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, - mgaReg->Option); - if (pMga->Chipset != PCI_CHIP_MGA1064) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, - mgaReg->Option2); - if (pMga->Chipset == PCI_CHIP_MGAG400) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, - mgaReg->Option3); + if (!MGAISG450(pMga)) { + /* restore pci_option register */ + pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, + mgaReg->Option); + if (pMga->Chipset != PCI_CHIP_MGA1064) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, + mgaReg->Option2); + if (pMga->Chipset == PCI_CHIP_MGAG400) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, + mgaReg->Option3); + } ); /* MGA_NOT_HAL */ /* restore CRTCEXT regs */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index 73fbb11bd..09221b4aa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.14 2000/12/11 22:34:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.16 2001/01/08 01:07:37 martin Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index d8e27a6c2..10aa74cbb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -42,8 +42,8 @@ * doug@netcom.com * Fixed 32bpp hires 8MB horizontal line glitch at middle right */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.185 2000/12/07 20:26:21 dawes Exp $ */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.189 2001/02/15 18:16:18 eich Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -96,11 +96,6 @@ #include "dri.h" #endif - -#ifdef RENDER -#include "picturestr.h" -#endif - /* * Forward definitions for the functions that make up the driver. */ @@ -129,11 +124,9 @@ static void VgaIORestore(int i, void *arg); static void MGAFreeScreen(int scrnIndex, int flags); static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -143,6 +136,7 @@ static void MGARestore(ScrnInfoPtr pScrn); static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); void MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags); static void MGABlockHandler(int, pointer, pointer, pointer); +static void MGAG100BlackMagic(MGAPtr pMga); static int MGAEntityIndex = -1; @@ -157,9 +151,6 @@ static int MGAEntityIndex = -1; DriverRec MGA_C_NAME = { MGA_VERSION, MGA_DRIVER_NAME, -#if 0 - "accelerated driver for Matrox Millennium and Mystique cards", -#endif MGAIdentify, MGAProbe, MGAAvailableOptions, @@ -212,13 +203,16 @@ typedef enum { OPTION_ROTATE, OPTION_TEXTURED_VIDEO, OPTION_CRTC2HALF, + OPTION_CRTC2RAM, OPTION_INT10, OPTION_AGP_MODE, OPTION_DIGITAL, OPTION_TV, OPTION_TVSTANDARD, OPTION_CABLETYPE, - OPTION_NOHAL + OPTION_USEIRQZERO, + OPTION_NOHAL, + OPTION_SWAPPED_HEAD } MGAOpts; static OptionInfoRec MGAOptions[] = { @@ -239,6 +233,7 @@ static OptionInfoRec MGAOptions[] = { { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_TEXTURED_VIDEO, "TexturedVideo",OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CRTC2HALF, "Crtc2Half", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CRTC2RAM, "Crtc2Ram", OPTV_INTEGER, {0}, FALSE }, { OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, { OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE }, @@ -246,6 +241,7 @@ static OptionInfoRec MGAOptions[] = { { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, { OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -1157,6 +1153,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) MGAMODEINFO mgaModeInfo = {0}; Bool digital = FALSE; Bool tv = FALSE; + Bool swap_head = FALSE; #endif /* @@ -1372,9 +1369,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, MGAOptions); pMga->softbooted = FALSE; - if (xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) && - xf86LoadSubModule(pScrn, "int10")) - { + if (xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) && + xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); @@ -1387,7 +1383,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->depth == 8) pScrn->rgbBits = 8; - /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -1416,13 +1411,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } #ifdef USEMGAHAL - if (HAL_CHIPSETS && !xf86ReturnOptValBool(MGAOptions, OPTION_NOHAL, FALSE) - && xf86LoadSubModule(pScrn, "mga_hal")) { + if (HAL_CHIPSETS && !xf86ReturnOptValBool(MGAOptions, OPTION_NOHAL, FALSE) + && xf86LoadSubModule(pScrn, "mga_hal")) { xf86LoaderReqSymLists(halSymbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Matrox HAL module used\n"); pMga->HALLoaded = TRUE; - } else + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not found - using builtin mode setup instead\n"); pMga->HALLoaded = FALSE; + } #endif /* @@ -1759,8 +1756,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86GetOptValBool(MGAOptions, OPTION_CRTC2HALF, &UseHalf); adjust = pScrn->videoRam / 2; - if (UseHalf == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if (UseHalf == TRUE || xf86GetOptValInteger(MGAOptions, OPTION_CRTC2RAM, &adjust)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Crtc2 will use %dK of VideoRam\n", adjust); } else { @@ -1900,11 +1897,16 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } if(pMga->SecondCrtc == TRUE) { /* Override on 2nd crtc */ - pMga->MaxClock = 112000; + + if (pMga->ChipRev >= 0x80) { /* G450 */ + pMga->MaxClock = 234000; + } else { + pMga->MaxClock = 135000; + } } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", pMga->MaxClock / 1000); - /* + /* * Setup the ClockRanges, which describe what clock ranges are available, * and what sort of modes they can be used for. */ @@ -2016,6 +2018,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } #ifdef USEMGAHAL MGA_HAL( + swap_head + = xf86ReturnOptValBool(MGAOptions, OPTION_SWAPPED_HEAD, FALSE); + if(pMga->SecondCrtc == FALSE) { pMga->pBoard = (LPBOARDHANDLE) xalloc (sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA)); @@ -2032,8 +2037,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMgaEnt->pClientStruct = pMga->pClientStruct; pMgaEnt->pBoard = pMga->pBoard; pMgaEnt->pMgaHwInfo = pMga->pMgaHwInfo; - } - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1; + } + + if (!swap_head) { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1; + } else { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2; + } mgaModeInfo.ulDispWidth = pScrn->virtualX; mgaModeInfo.ulDispHeight = pScrn->virtualY; mgaModeInfo.ulDeskWidth = pScrn->virtualX; @@ -2048,8 +2058,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) mgaModeInfo.flOutput = MGAMODEINFO_TV | MGAMODEINFO_SECOND_CRTC; } else { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC; + if (!swap_head) { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | + MGAMODEINFO_SECOND_CRTC; + } else { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1 | + MGAMODEINFO_SECOND_CRTC; + } } mgaModeInfo.ulDispWidth = pScrn->virtualX; mgaModeInfo.ulDispHeight = pScrn->virtualY; @@ -2082,10 +2097,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * Can we trust HALlib to set the memory configuration * registers correctly? */ - else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && - (pMga->Chipset != PCI_CHIP_MGA2064) && - (pMga->Chipset != PCI_CHIP_MGA2164) && - (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { + else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && + (pMga->Chipset != PCI_CHIP_MGA2064) && + (pMga->Chipset != PCI_CHIP_MGA2164) && + (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { CARD32 option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG); if(!(option_reg & (1 << 14))) { pMga->HasSDRAM = TRUE; @@ -2102,11 +2117,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * are not pre-initialised at all. */ #ifdef USEMGAHAL - MGA_HAL(xf86SetCrtcForModes(pScrn, 0)); - MGA_NOT_HAL(xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V)); -#else - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + MGA_HAL(xf86SetCrtcForModes(pScrn, 0)); #endif + MGA_NOT_HAL(xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V)); /* Set the current mode to the first in the list */ pScrn->currentMode = pScrn->modes; @@ -2226,9 +2239,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } reqSym = "fbScreenInit"; -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif } xf86LoaderReqSymbols(reqSym, NULL); @@ -2455,8 +2466,7 @@ MGASave(ScrnInfoPtr pScrn) if(pMga->SecondCrtc == TRUE) return; #ifdef USEMGAHAL - if (pMga->HALLoaded) - MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard)); + MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard)); #endif /* Only save text mode fonts/text for the primary card */ @@ -2545,13 +2555,13 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) Bool digital = FALSE; Bool tv = FALSE; ULONG status; + Bool swap_head + = xf86ReturnOptValBool(MGAOptions, OPTION_SWAPPED_HEAD, FALSE); - if (pMga->HALLoaded) { - /* Verify if user wants digital screen output */ - xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital); - /* Verify if user wants TV output */ - xf86GetOptValBool(MGAOptions, OPTION_TV, &tv); - } + /* Verify if user wants digital screen output */ + xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital); + /* Verify if user wants TV output */ + xf86GetOptValBool(MGAOptions, OPTION_TV, &tv); #endif vgaHWUnlock(hwp); @@ -2570,7 +2580,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) mgaReg = &pMga->ModeReg; #ifdef USEMGAHAL - MGA_HAL( + MGA_HAL( FillModeInfoStruct(pScrn,mode); if(pMga->SecondCrtc == TRUE) { @@ -2585,14 +2595,26 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG; } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; + if (!swap_head) { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | + MGAMODEINFO_SECOND_CRTC | + MGAMODEINFO_FORCE_PITCH | + MGAMODEINFO_FORCE_DISPLAYORG; + } else { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | + MGAMODEINFO_SECOND_CRTC | + MGAMODEINFO_FORCE_PITCH | + MGAMODEINFO_FORCE_DISPLAYORG; + } } } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | - MGAMODEINFO_FORCE_PITCH; + if (!swap_head) { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | + MGAMODEINFO_FORCE_PITCH; + } else { + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | + MGAMODEINFO_FORCE_PITCH; + } } pMga->pMgaModeInfo->ulFBPitch = pScrn->displayWidth; @@ -2635,10 +2657,8 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, pMga->FbCursorOffset >> 18); } ); /* MGA_HAL */ - MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); -#else - (*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE); #endif + MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); MGAStormSync(pScrn); MGAStormEngineInit(pScrn); @@ -2681,12 +2701,12 @@ MGARestore(ScrnInfoPtr pScrn) vgaHWProtect(pScrn, TRUE); if (pMga->Primary) { #ifdef USEMGAHAL - MGA_HAL( - if(pMga->pBoard != NULL) { - MGASetVgaMode(pMga->pBoard); - MGARestoreVgaState(pMga->pBoard); - } - ); /* MGA_HAL */ + MGA_HAL( + if(pMga->pBoard != NULL) { + MGASetVgaMode(pMga->pBoard); + MGARestoreVgaState(pMga->pBoard); + } + ); /* MGA_HAL */ #endif (*pMga->Restore)(pScrn, vgaReg, mgaReg, TRUE); } else { @@ -2754,6 +2774,10 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } + if ((pMga->Chipset == PCI_CHIP_MGAG100) + || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) + MGAG100BlackMagic(pMga); + if (xf86IsEntityShared(pScrn->entityList[0])) { DevUnion *pPriv; pPriv = xf86GetEntityPrivate(pScrn->entityList[0], MGAEntityIndex); @@ -2787,7 +2811,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->pBoard = pMgaEnt->pBoard; pMga->pMgaHwInfo = pMgaEnt->pMgaHwInfo; } - ); + ); /* MGA_HAL */ #endif } else { #ifdef USEMGAHAL @@ -2804,14 +2828,14 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #ifdef USEMGAHAL MGA_HAL( - /* There is a problem in the HALlib: set soft reset bit */ - if ( !pMga->Primary && !pMga->FBDev && - (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { - OUTREG(MGAREG_Reset, 1); - usleep(200); - OUTREG(MGAREG_Reset, 0); - } - ) + /* There is a problem in the HALlib: set soft reset bit */ + if (!pMga->Primary && !pMga->FBDev && + (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { + OUTREG(MGAREG_Reset, 1); + usleep(200); + OUTREG(MGAREG_Reset, 0); + } + ); /* MGA_HAL */ #endif /* Initialise the MMIO vgahw functions */ @@ -2944,10 +2968,8 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit (pScreen, 0, 0); -#endif } if (!ret) @@ -3035,10 +3057,8 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ShadowFBInit(pScreen, refreshArea); } -#ifdef DPMSExtension xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); -#endif - + pScrn->memPhysBase = pMga->FbAddress; pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); @@ -3459,7 +3479,6 @@ MGASaveScreen(ScreenPtr pScreen, int mode) * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -3498,7 +3517,6 @@ MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, crtcext1 |= INREG8(0x1FDF) & ~0x30; OUTREG8(0x1FDF, crtcext1); } -#endif static void @@ -3635,3 +3653,12 @@ dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val) *(volatile CARD32 *)(pMga->IOBase + (addr)) = (val); } #endif /* DEBUG */ + +static void +MGAG100BlackMagic(MGAPtr pMga) +{ + OUTREG(MGAREG_PLNWT, ~(CARD32)0x0); + /* reset memory */ + OUTREG(MGAREG_MACCESS, 1<<15); + usleep(10); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h index db0180527..63385747c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.18 2000/12/06 15:35:21 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.19 2001/02/13 19:19:16 dawes Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ @@ -107,4 +107,6 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \ #define MGA_NOT_HAL(x) { x; } #endif +#define MGAISG450(x) ( ((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80) ) + #endif /* _MGA_MACROS_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c index d9c83d9ba..7b1308a24 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.81 2000/12/14 16:33:09 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.84 2001/02/16 15:39:35 alanh Exp $ */ /* All drivers should typically include these */ @@ -37,6 +37,12 @@ #include "mga_dri.h" #endif +#define MGAMoveDWORDS(d,s,c) \ +do { \ + write_mem_barrier(); \ + XAAMoveDWORDS((d),(s),(c)); \ +} while (0) + static void MGANAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); @@ -1119,8 +1125,11 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) pMga->MAccess = maccess; pMga->PlaneMask = ~0; /* looks like this doesn't apply to mga g100 pci */ - if (pMga->Chipset != PCI_CHIP_MGAG100) - OUTREG(MGAREG_PLNWT, pMga->PlaneMask); + + if ((pMga->Chipset != PCI_CHIP_MGAG100) + && (pMga->Chipset != PCI_CHIP_MGAG100_PCI)) + OUTREG(MGAREG_PLNWT, pMga->PlaneMask); + pMga->FgColor = 0; OUTREG(MGAREG_FCOL, pMga->FgColor); pMga->BgColor = 0; @@ -1689,7 +1698,12 @@ MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); - if(pMga->expandDWORDs > pMga->FifoSize) { +#ifdef __alpha__ + if(1) +#else + if(pMga->expandDWORDs > pMga->FifoSize) +#endif + { pMga->AccelInfoRec->SubsequentColorExpandScanline = MGANAME(SubsequentColorExpandScanlineIndirect); pMga->AccelInfoRec->ScanlineColorExpandBuffers = @@ -1714,13 +1728,13 @@ MGANAME(SubsequentColorExpandScanlineIndirect)( while(dwords > pMga->FifoSize) { WAITFIFO(pMga->FifoSize); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); src += pMga->FifoSize; dwords -= pMga->FifoSize; } WAITFIFO(dwords); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); if(!(--pMga->expandRows)) { if(pMga->expandRemaining) { @@ -1816,13 +1830,13 @@ static void MGANAME(SubsequentImageWriteScanline)( while(dwords > pMga->FifoSize) { WAITFIFO(pMga->FifoSize); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); src += pMga->FifoSize; dwords -= pMga->FifoSize; } WAITFIFO(dwords); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); if(!(--pMga->expandRows)) { DISABLE_CLIP(); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c index 940e22148..391194b04 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.21 2000/12/05 20:03:45 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.22 2000/12/21 00:10:56 mvojkovi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -703,9 +703,9 @@ MGADisplayVideoOverlay( OUTREG(MGAREG_BESA1ORG, offset); if(y1 & 0x00010000) - OUTREG(MGAREG_BESCTL, 0x00050c41); + OUTREG(MGAREG_BESCTL, 0x00040c41); else - OUTREG(MGAREG_BESCTL, 0x00050c01); + OUTREG(MGAREG_BESCTL, 0x00040c01); OUTREG(MGAREG_BESHCOORD, (dstBox->x1 << 16) | (dstBox->x2 - 1)); OUTREG(MGAREG_BESVCOORD, (dstBox->y1 << 16) | (dstBox->y2 - 1)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp deleted file mode 100644 index a3b1d5acc..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp +++ /dev/null @@ -1,90 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp,v 1.7 2000/12/14 08:11:15 herrb Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH NEOMAGIC __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -neomagic \- Neomagic video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qneomagic\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B neomagic -is an XFree86 driver for the Neomagic graphics chipsets found in many -laptop computers. -.SH SUPPORTED HARDWARE -.B neomagic -supports the following chipsets: -.PP -.TP -MagicGraph 128 (NM2070) -.TP -MagicGraph 128V (NM2090) -.TP -MagicGraph 128ZV (NM2093) -.TP -MagicGraph 128ZV+ (NM2097) -.TP -MagicGraph 128XD (NM2160) -.TP -MagicGraph 256AV (NM2200) -.TP -MagicGraph 256AV+ (NM2230) -.TP -MagicGraph 256ZX (NM2360) -.TP -MagicGraph 256XL+ (NM2380) -.PP -The driver supports depths 8, 15, 16 and 24 for all chipsets except the -NM2070 which does not support depth 24. All depths are accelerated except for -depth 24 which is only accelerated on NM2200 -and newer models. All visuals are supported in depth 8. TrueColor and -DirectColor visuals are supported in the other depths. - -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disable or enable software cursor. Default: software cursor is disable -and a hardware cursor is used. -.TP -.BI "Option \*qPCIBurst\*q \*q" boolean \*q -Disable or enable PCI burst modes. Default: enabled. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.PP -.B Note -.br -On some laptops using the 2160 chipset (MagicGraph 128XD) the -following options are needed to avoid a lock-up of the graphic engine: -.nf - Option "XaaNoScanlineImageWriteRect" - Option "XaaNoScanlineCPUToScreenColorExpandFill" -.fi - -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jens Owen, Kevin E. Martin, and also Egbert Eich, -Mark Vojkovich, Alan Hourihane. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile index f29a52de1..f3fc19a4b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.2 2000/12/14 20:59:12 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.3 2001/01/24 00:06:22 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -34,7 +34,6 @@ InstallObjectModule(newport,$(MODULEDIR),drivers) InstallNamedNonExec($(XF86CONFIG),$(XF86CONFIG),$(LIBDIR)) #if !defined(XF86DriverSDK) -CppManTarget(newport,) InstallModuleManPage(newport) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp deleted file mode 100644 index 3eb1954bd..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp +++ /dev/null @@ -1,40 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp,v 1.1 2000/12/14 20:59:12 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH NEWPORT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -newport \- Newport video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qnewport\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B newport -is an XFree86 driver for the SGI Indy's newport video cards. -.SH SUPPORTED HARDWARE -The -.B newport -driver supports the Newport(sometimes called XL) cards found in SGI Indys. It -does not support the XZ boards. The driver is currently limited to 8bit only. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects all device information necessary to initialize -the card. However, if you have problems with auto-detection, you can -specify: -.br -.TP -.BI "Option \*qbitplanes\*q \*q" integer \*q -number of bitplanes of the board (8 or 24) -Default: auto-detected. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors: -Guido Guenther \fIguido.guenther@gmx.net\fP diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp deleted file mode 100644 index 4f748aa57..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp +++ /dev/null @@ -1,61 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp,v 1.3 1999/08/28 09:01:06 dawes Exp $ -.TH NV __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -nv \-NVIDIA video driver -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""nv""" -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B nv -is an XFree86 driver for NVIDIA video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 15, 16 and 24. All -visual types are supported for depth 8, and both TrueColor and DirectColor -visuals are supported for the other depths. Multi-head configurations -are supported. -.SH SUPPORTED HARDWARE -The -.B nv -driver supports PCI and AGP video cards based on the following NVIDIA chips: -.TP 12 -.B RIVA 128 -NV3 -.TP 12 -.B RIVA TNT -NV4 -.TP 12 -.B RIVA TNT2 -NV5 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type and the amount of video memory -present for all chips. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option ""HWCursor"" """ boolean """ -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option ""NoAccel"" """ boolean """ -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option ""UseFBDev"" """ boolean """ -Enable or disable use of on OS-specific fb interface (and is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1) -.SH AUTHORS -Authors include: David McKay, Jarno Paananen, Chas Inman, Dave Schmenk diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c index be3fa3d0e..5effc7955 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c @@ -2,19 +2,13 @@ Copyright (c) 1999, The XFree86 Project Inc. Written by Mark Vojkovich <markv@valinux.com> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.5 2000/03/13 18:49:29 mvojkovi Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "shadowfb.h" -#include "servermd.h" +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.6 2001/01/22 21:32:36 dawes Exp $ */ + #include "nv_local.h" +#include "nv_include.h" #include "nv_type.h" - +#include "shadowfb.h" +#include "servermd.h" void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp b/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp deleted file mode 100644 index e60216399..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp +++ /dev/null @@ -1,112 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp,v 1.7 2000/12/12 18:54:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH RENDITION __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -rendition \- Rendition video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qrendition\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B rendition -is an XFree86 driver for Rendition/Micron based video cards. The driver -supports following framebuffer depths: 8, 15 (Verite V1000 only), 16 -and 24. Acceleration and multi-head configurations are -not supported yet, but are work in progress. -.SH SUPPORTED HARDWARE -The -.B rendition -driver supports PCI and AGP video cards based on the following Rendition/Micron chips: -.TP 12 -.B V1000 -Verite V1000 based cards. -.TP 12 -.B V2100 -Verite V2100 based cards. Diamond Stealth II S220 is the only known such card. -.TP 12 -.B V2200 -Verite V2200 based cards. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"v1000", "v2100", "v2200". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chips. If the amount of memory is detected incorrectly, the actual amount -of video memory should be specified with a -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disables use of the hardware cursor. Default: use HW-cursor. -.TP -.BI "Option \*qOverclockMem\*q \*q" boolean \*q -Increases the Mem/Sys clock to 125MHz/60MHz from standard 110MHz/50MHz. -Default: Not overclocked. -.TP -.BI "Option \*qDacSpeed\*q \*q" MHz \*q -Run the memory at a higher clock. Useful on some cards with display glitches -at higher resolutions. But adds the risk to damage the hardware. Use with -caution. -.TP -.BI "Option \*qFramebufferWC\*q \*q" boolean \*q -If writecombine is disabled in BIOS, and you add this option in configuration -file, then the driver will try to request writecombined access to the -framebuffer. This can drastically increase the performance on unaccelerated -server. Requires that "MTRR"-support is compiled into the OS-kernel. -Default: Disabled for V1000, enabled for V2100/V2200. -.TP -.BI "Option \*qNoDDC\*q \*q" boolean \*q -Disable probing of DDC-information from your monitor. This information is not -used yet and is only there for informational purposes. This might change -before final XFree86 4.0 release. Safe to disable if you experience problems -during startup of X-server. -Default: Probe DDC. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -If this option is enabled, the driver will cause the CPU to do each drawing -operation first into a shadow frame buffer in system virtual memory and then -copy the result into video memory. If this option is not active, the CPU will -draw directly into video memory. Enabling this option is beneficial for those -systems where reading from video memory is, on average, slower than the -corresponding read/modify/write operation in system virtual memory. This is -normally the case for PCI or AGP adapters, and, so, this option is enabled by -default unless acceleration is enabled. -Default: Enabled unless acceleration is used. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.SH "Notes" -For the moment the driver defaults to not request write-combine for any chipset -as there has been indications of problems with it. Use -.B "Option \*qMTRR\*q" -to let the driver request write-combining of memory access on the video board. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Marc Langenbach, Dejan Ilic diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c index 87c0076e1..2353118fa 100755 --- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.2 2000/11/28 20:59:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.3 2001/02/09 03:23:30 dawes Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -106,9 +106,9 @@ void S3VInitVideo(ScreenPtr pScreen) (pScrn->bitsPerPixel == 16) ) && - ((ps3v->Chipset == S3_ViRGE_DXGX) || + ((ps3v->Chipset == S3_ViRGE_DXGX) /* || */ /* S3_ViRGE_GX2_SERIES(ps3v->Chipset) || */ - (ps3v->Chipset == S3_ViRGE) + /* (ps3v->Chipset == S3_ViRGE) */ ) && !ps3v->NoAccel ) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp deleted file mode 100644 index 44ba44e9f..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp +++ /dev/null @@ -1,186 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp,v 1.4 1999/08/22 13:04:27 dawes Exp $ -.TH s3virge __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -s3virge \- S3 ViRGE video driver -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""s3virge""" -.br -\ \ ... -.br -\ \ [ -.B "Option" -"optionname" ["optionvalue"]] -.br -.B EndSection -.SH DESCRIPTION -.B s3virge -is an XFree86 driver for S3 based video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 15, 16, and 24. All -visual types are supported for depth 8, and TrueColor -visuals are supported for the other depths. -.SH SUPPORTED HARDWARE -The -.B s3virge -driver supports PCI video cards based on the following S3 chips: -.TP 12 -.B ViRGE -86C325 -.TP 12 -.B ViRGE VX -86C988 -.TP 12 -.B ViRGE DX -86C375 -.TP 12 -.B ViRGE GX -86C385 -.TP 12 -.B ViRGE GX2 -86C357 -.TP 12 -.B ViRGE MX -86C260 -.TP 12 -.B ViRGE MX+ -86C280 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B """Device""" -section, and will override the auto-detection: -.PP -.RS 4 -"virge", "86c325", "virge vx", "86c988", "virge dx", "86c375", -"virge gx", "86c385", "virge gx2", "86c357", "virge mx", "86c260", -"virge mx+", "86c280". -.RE -.PP -The following Cursor -.B Options -are supported: -.TP -.BI "Option ""HWCursor"" """ boolean """ -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option ""SWCursor"" """ boolean """ -Inverse of "HWCursor". Default: off. -.PP -The following video memory -.B Options -are supported: -.TP -.BI "Option ""slow_edodram""" -Switch the standard ViRGE to 2-cycle edo mode. Try this -if you encounter pixel corruption on the ViRGE. Using this option will -cause a large decrease in performance. Default: off -.TP -.BI "Option ""fpm_vram""" -Switch the ViRGE/VX to fast page mode vram mode. Default: off. -.TP -.BR "Option ""early_ras_precharge " | " late_ras_precharge""" -adjust memory parameters. One -of these will us the same settings as your video card defaults, and -using neither in the config file does the same. Default: none. -.TP -.BI "Option ""set_mclk"" """ integer """ -sets the memory clock, where -.I integer -is in kHz, and -.I integer -<= 100000. Default: probe the memory clock value, -and use it at server start. -.PP -The following acceleration and graphic engine -.B Options -are supported: -.TP -.B "Option ""NoAccel"" -Disable acceleration. Very useful for determining if the -driver has problems with drawing and acceleration routines. This is the first -option to try if your server runs but you see graphic corruption on the screen. -Using it decreases performance, as it uses software emulation for drawing -operations the video driver can accelerate with hardware. -Default: acceleration is enabled. -.TP -.BR "Option ""fifo_aggressive " | " fifo_moderate " | " fifo_conservative""" -alter the settings -for the threshold at which the pixel FIFO takes over the internal -memory bus to refill itself. The smaller this threshold, the better -the acceleration performance of the card. You may try the fastest -setting -.RB ( "fifo_aggressive" ) -and move down if you encounter pixel corruption. -The optimal setting will probably depend on dot-clock and on color -depth. Note that specifying any of these options will also alter other -memory settings which may increase performance, so trying -.B "fifo_conservative" -will in most cases be a slight benefit (this uses the chip defaults). -If pixel corruption or transient streaking is observed during drawing -operations then removing any fifo options is recommended. Default: none. - -.PP -The following PCI bus -.B Options -are supported: -.TP -.BI "Option ""pci_burst"" """ boolean """ -will enable PCI burst mode. This should work on all but a -few broken PCI chipsets, and will increase performance. Default: off. -.TP -.BI "Option ""pci_retry"" """ boolean """ -will allow the driver to rely on PCI Retry to program the -ViRGE registers. -.B "pci_burst" -must be enabled for this to work. -This will increase performance, especially for small fills/blits, -because the driver does not have to poll the ViRGE before sending it -commands to make sure it is ready. It should work on most -recent PCI chipsets. Default: off. -.PP -The following ViRGE MX LCD -.B Options -are supported: -.TP -.BI "Option ""lcd_center"" -.TP -.BI "Option ""set_lcdclk"" """ integer """ -allows setting the clock for a ViRGE MX LCD display. -.I integer -is in Hz. Default: use probed value. - -.PP -The following additional -.B Options -are supported: -.TP -.BI "Option ""ShowCache"" """ boolean """ -Enable or disable viewing offscreen memory. Default: off. - -.SH SEE ALSO -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1) - -.SH SUPPORT -For assistance with this driver, or XFree86 in general, check the XFree86 web -site at http://www.xfree86.org. A FAQ is available on the web site at -http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a -question not answered in the FAQ please use our bug report form available on -the web site or send mail to XFree86@XFree86.org. When reporting problems -with the driver send as much detail as possible, including chipset type, a -server output log, and operating system specifics. - -.SH AUTHORS -Kevin Brosius, -Matt Grossman, -Harald Koenig, -Sebastien Marineau, -Mark Vojkovich. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp deleted file mode 100644 index d35f7f8ad..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp +++ /dev/null @@ -1,96 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp,v 1.2 2000/12/11 20:18:25 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SAVAGE __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -savage \- S3 Savage video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsavage\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B savage -is an XFree86 driver for the S3 Savage family video accelerator chips. The -.B savage -driver supports PCI and AGP boards with the following chips: -.TP 16 -.BI Savage3D -(8a20 and 8a21) -.TP 16 -.B Savage4 -(8a22) -.TP 16 -.B Savage2000 -(9102) -.TP 16 -.B Savage/MX -(8c10 and 8c11) -.TP 16 -.B Savage/IX -(8c12 and 8c13) -.TP 16 -.B ProSavage PM133 -(8a25) -.TP 16 -.B ProSavage KM133 -(8a26) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -These two options interact to specify hardware or software cursor. If the -SWCursor option is specified, any HWCursor setting is ignored. Thus, either -\*qHWCursor off\*q or \*qSWCursor on\*q will force the use of the software -cursor. On Savage/MX and Savage/IX chips which are connected to LCDs, a -software cursor will be forced, because the Savage hardware cursor does not -correctly track the automatic panel expansion feature. -Default: hardware cursor. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the desktop 90 degrees clockwise or counterclockwise. This option -forces the ShadowFB option on, and disables acceleration. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. This option -disables acceleration. Default: off. -.TP -.BI "Option \*qUseBIOS\*q \*q" boolean \*q -Enable or disable use of the video BIOS to change modes. Ordinarily, the -.B savage -driver tries to use the video BIOS to do mode switches. This generally -produces the best results with the mobile chips (/MX and /IX), since the BIOS -knows how to handle the critical but unusual timing requirements of the -various LCD panels supported by the chip. To do this, the driver searches -through the BIOS mode list, looking for the mode which most closely matches -the XF86Config mode line. Some purists find this scheme objectionable. If -you would rather have the -.B savage -driver use your mode line timing exactly, turn off the UseBios option. -Default: on (use the BIOS). -.SH FILES -savage_drv.o -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include Tim Roberts (timr@probo.com) and Ani Joshi (ajoshi@unixbox.com) -for the 4.0 version, and Tim Roberts and S. Marineau for the 3.3 driver from -which this was derived. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c index 2dfaf1432..b31a08d26 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.4 2000/12/07 20:26:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.5 2001/02/13 21:15:19 dawes Exp $ */ /* * @@ -15,14 +15,10 @@ * */ +#include <math.h> #include "Xarch.h" -#include "xf86.h" -#include "xf86_ansic.h" -#include "xf86_OSproc.h" -#include "compiler.h" #include "xaalocal.h" #include "xaarop.h" -#include "xf86PciInfo.h" #include "miline.h" #include "savage_driver.h" @@ -30,16 +26,10 @@ #include "savage_bci.h" -/* Globals used in driver */ -extern pointer s3savMmioMem; -#ifdef __alpha__ -extern pointer s3savMmioMemSparse; -#endif +static unsigned int dwBCIWait2DIdle; /* Forward declaration of functions used in the driver */ -static void SavageAccelSync( ScrnInfoPtr ); - static void SavageSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, @@ -220,7 +210,7 @@ void SavageSetGBD( ScrnInfoPtr ); * call from the debugger. */ -static ScrnInfoPtr gpScrn = 0; +ScrnInfoPtr gpScrn = 0; @@ -265,7 +255,7 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn) OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); /* Disable shadow status update */ OUTREG(0x48C0C, 0); - /* Enabel BCI without the COB */ + /* Enable BCI without the COB */ OUTREG(0x48C18, INREG(0x48C18) | 0x08); break; @@ -294,6 +284,14 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn) BCI_BD_SET_STRIDE(psav->SavedGbd, pScrn->displayWidth); SavageSetGBD(pScrn); + + if( psav->StatusHack ) + { + if( psav->Chipset == S3_SAVAGE2000 ) + dwBCIWait2DIdle = 0xc0040000; + else + dwBCIWait2DIdle = 0xc0020000; + } } @@ -335,8 +333,8 @@ SavageSetGBD( ScrnInfoPtr pScrn ) OUTREG(0x8178,0); OUTREG(0x817C,psav->SavedGbd); - OUTREG(0x81C8, pScrn->displayWidth << 4); - OUTREG(0x81D8, pScrn->displayWidth << 4); + OUTREG(PRI_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); + OUTREG(SEC_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); } @@ -352,18 +350,18 @@ SavageInitAccel(ScreenPtr pScreen) /* Set-up our GE command primitive */ - if (pScrn->bitsPerPixel == 8) { - psav->PlaneMask = 0xFF; - } - else if (pScrn->bitsPerPixel == 16) { - psav->PlaneMask = 0xFFFF; - } - else if (pScrn->bitsPerPixel == 24) { - psav->PlaneMask = 0xFFFFFF; - } - else if (pScrn->bitsPerPixel == 32) { - psav->PlaneMask = 0xFFFFFFFF; - } + if (pScrn->depth == 8) { + psav->PlaneMask = 0xFF; + } + else if (pScrn->depth == 15) { + psav->PlaneMask = 0x7FFF; + } + else if (pScrn->depth == 16) { + psav->PlaneMask = 0xFFFF; + } + else if (pScrn->depth == 24) { + psav->PlaneMask = 0xFFFFFF; + } /* General acceleration flags */ @@ -504,7 +502,7 @@ SavageInitAccel(ScreenPtr pScreen) psav->Bpp = pScrn->bitsPerPixel / 8; psav->Bpl = pScrn->displayWidth * psav->Bpp; - psav->ScissB = psav->CursorKByte / psav->Bpl; + psav->ScissB = (psav->CursorKByte << 10) / psav->Bpl; if (psav->ScissB > 2047) psav->ScissB = 2047; @@ -520,6 +518,9 @@ SavageInitAccel(ScreenPtr pScreen) AvailFBArea.x2 = pScrn->displayWidth; AvailFBArea.y2 = psav->ScissB; xf86InitFBManager(pScreen, &AvailFBArea); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Using %d lines for offscreen memory.\n", + psav->ScissB - pScrn->virtualY ); return XAAInit(pScreen, xaaptr); } @@ -532,9 +533,44 @@ void SavageAccelSync(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); - WaitIdleEmpty(); + + if( psav->StatusHack ) + { + static int counter = 0; + int i; + + /* + * This is an attempt to work around the status register read hang + * that affects about 4% of all Savage chips. Instead of reading + * the register through MMIO, we send a BCI command to wait for + * engine idle (which does not hang), then another BCI command to + * set an incrementing value into an innocuous register (the + * Cr Base register used in YUV page flipping). Then we loop + * waiting for the MMIO value of that register to change. + */ + + BCI_GET_PTR; + BCI_SEND(dwBCIWait2DIdle); /* wait for 2D idle */ + BCI_SEND(0x96010045); /* update New Cr Base Address ... */ + counter++; + BCI_SEND(counter); /* ... to this value */ + for( + i = 0; + (INREG(0x48914) != counter) && (i < 100000); + i++ + ) + ; + } + else + { + if( psav->StatusDelay ) + usleep( psav->StatusDelay ); + WaitIdleEmpty(); + } } +#undef WaitQueue +#define WaitQueue(x) SavageAccelSync(pScrn) /* * The XAA ROP helper routines all assume that a solid color is a @@ -731,6 +767,9 @@ SavageSubsequentSolidFillRect( { SavagePtr psav = SAVPTR(pScrn); BCI_GET_PTR; + + if( !w || !h ) + return; WaitQueue(5); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c index 4227e11c7..ba7cf5adc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.6 2000/12/12 16:50:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.11 2001/02/15 20:00:19 eich Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -15,11 +15,13 @@ #include "xf86RAC.h" #include "shadowfb.h" -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif /* DPMSExtension */ + +#ifdef XvExtension +#include "xf86xv.h" +#endif #include "savage_driver.h" #include "savage_bci.h" @@ -41,7 +43,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags); static Bool SavageEnterVT(int scrnIndex, int flags); static void SavageLeaveVT(int scrnIndex, int flags); static void SavageSave(ScrnInfoPtr pScrn); -static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, SavageRegPtr); +static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, SavageRegPtr, Bool); static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv); @@ -49,9 +51,10 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen); static ModeStatus SavageValidMode(int index, DisplayModePtr mode, Bool verbose, int flags); +void SavageDGAInit(ScreenPtr); static Bool SavageMapMMIO(ScrnInfoPtr pScrn); static Bool SavageMapFB(ScrnInfoPtr pScrn); -static void SavageUnmapMem(ScrnInfoPtr pScrn); +static void SavageUnmapMem(ScrnInfoPtr pScrn, int All); static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SavageSaveScreen(ScreenPtr pScreen, int mode); @@ -64,24 +67,32 @@ static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, unsigned int *ndiv, unsigned int *r); void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file); void SavagePrintRegs(ScrnInfoPtr pScrn); -#ifdef DPMSExtension static void SavageDPMS(ScrnInfoPtr pScrn, int mode, int flags); -#endif +static Bool SavageDDC1(int scrnIndex); +static unsigned int SavageDDC1Read(ScrnInfoPtr pScrn); +static void SavageProbeDDC(ScrnInfoPtr pScrn, int index); -static int pix24bpp = 0; +extern ScrnInfoPtr gpScrn; #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.0" +#define DRIVER_VERSION "1.1.12" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 0 +#define PATCHLEVEL 12 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) +/* #define TRACEON */ +#ifdef TRACEON +#define TRACE(prms) ErrorF prms +#else +#define TRACE(prms) +#endif + DriverRec SAVAGE = { SAVAGE_VERSION, @@ -107,6 +118,9 @@ static SymTabRec SavageChips[] = { { PCI_CHIP_SAVAGE_IX, "Savage/IX" }, { PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133" }, { PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133" }, + /* Twister is a code name; hope I get the real name soon. */ + { PCI_CHIP_TWISTER_P, "TwisterP" }, + { PCI_CHIP_TWISTER_K, "TwisterK" }, { -1, NULL } }; @@ -132,22 +146,18 @@ static PciChipsets SavagePciChipsets[] = { { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_IX, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_PM, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_KM, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_TWISTER_P, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_TWISTER_K, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; typedef enum { - OPTION_SLOW_EDODRAM, - OPTION_SLOW_DRAM, - OPTION_FAST_DRAM, - OPTION_FPM_VRAM, OPTION_PCI_BURST, OPTION_FIFO_CONSERV, OPTION_FIFO_MODERATE, OPTION_FIFO_AGGRESSIVE, OPTION_PCI_RETRY, OPTION_NOACCEL, - OPTION_EARLY_RAS_PRECHARGE, - OPTION_LATE_RAS_PRECHARGE, OPTION_LCD_CENTER, OPTION_LCDCLOCK, OPTION_MCLK, @@ -157,23 +167,23 @@ typedef enum { OPTION_HWCURSOR, OPTION_SHADOW_FB, OPTION_ROTATE, - OPTION_USEBIOS + OPTION_USEBIOS, + OPTION_STATUS_DELAY, + OPTION_STATUS_HACK } SavageOpts; static OptionInfoRec SavageOptions[] = { - { OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FAST_DRAM, "fast_dram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FPM_VRAM, "fpm_vram", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, - /* finish later... */ + { OPTION_LCDCLOCK, "LCDClock", OPTV_FREQ, {0}, FALSE }, + { OPTION_STATUS_DELAY, "StatusDelay", OPTV_INTEGER, {0}, FALSE }, + { OPTION_STATUS_HACK, "StatusHack", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -208,6 +218,7 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", "vbeFree", + "VBESetVBEMode", NULL }; @@ -216,6 +227,12 @@ static const char *ddcSymbols[] = { NULL }; +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + static const char *xaaSymbols[] = { "XAACopyROP", "XAACopyROP_PM", @@ -224,6 +241,7 @@ static const char *xaaSymbols[] = { "XAAHelpPatternROP", "XAAHelpSolidROP", "XAAInit", + "XAAFillSolidRects", "XAAScreenIndex", NULL }; @@ -242,14 +260,9 @@ static const char *int10Symbols[] = { NULL }; -static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb24_32ScreenInit", - "cfb32ScreenInit", - "cfb16BresS", - "cfb24BresS", +static const char *fbSymbols[] = { + "fbScreenInit", + "fbPictureInit", NULL }; @@ -280,9 +293,9 @@ static pointer SavageSetup(pointer module, pointer opts, int *errmaj, if (!setupDone) { setupDone = TRUE; xf86AddDriver(&SAVAGE, module, 0); - LoaderRefSymLists(vgaHWSymbols, cfbSymbols, ramdacSymbols, + LoaderRefSymLists(vgaHWSymbols, fbSymbols, ramdacSymbols, xaaSymbols, shadowSymbols, vbeSymbols, - ddcSymbols, NULL); + int10Symbols, i2cSymbols, ddcSymbols, NULL); return (pointer) 1; } else { if (errmaj) @@ -395,8 +408,6 @@ WaitIdleEmpty2K(SavagePtr psav) { int loop = 0; mem_barrier(); - /* CAUTION! How do we insure this read isn't optimized away? */ - /* Is the "volatile" enough to do that? */ loop &= ALT_STATUS_WORD0; while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ) ; @@ -482,11 +493,12 @@ static Bool SavageGetRec(ScrnInfoPtr pScrn) static void SavageFreeRec(ScrnInfoPtr pScrn) { + TRACE(( "SavageFreeRec(%x)\n", pScrn->driverPrivate )); if (!pScrn->driverPrivate) return; xfree(pScrn->driverPrivate); pScrn->driverPrivate = NULL; - SavageUnmapMem(pScrn); + SavageUnmapMem(pScrn, 1); } @@ -499,7 +511,7 @@ static OptionInfoPtr SavageAvailableOptions(int chipid, int busid) static void SavageIdentify(int flags) { xf86PrintChipsets("SAVAGE", - "driver (version " DRIVER_VERSION " for S3 Savage chipsets", + "driver (version " DRIVER_VERSION ") for S3 Savage chipsets", SavageChips); } @@ -507,7 +519,7 @@ static void SavageIdentify(int flags) static Bool SavageProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections; + GDevPtr *devSections = NULL; int *usedChips; int numDevSections; int numUsed; @@ -523,7 +535,9 @@ static Bool SavageProbe(DriverPtr drv, int flags) SavageChipsets, SavagePciChipsets, devSections, numDevSections, drv, &usedChips); - xfree(devSections); + if (devSections) + xfree(devSections); + devSections = NULL; if (numUsed <= 0) return FALSE; @@ -574,23 +588,28 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) MessageType from = X_DEFAULT; int i; ClockRangePtr clockRanges; - char *mod = NULL; char *s = NULL; - const char *reqSym = NULL; unsigned char config1, m, n, n1, n2, sr8, cr66 = 0, tmp; int mclk; vgaHWPtr hwp; int vgaCRIndex, vgaCRReg, vgaIOBase; + pointer ddc; - if (flags & PROBE_DETECT) - return FALSE; + TRACE(("SavagePreInit(%d)\n", flags)); + + gpScrn = pScrn; + + if (flags & PROBE_DETECT) { + SavageProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); + return TRUE; + } if (!xf86LoadSubModule(pScrn, "vgahw")) - return FALSE; + return FALSE; xf86LoaderReqSymLists(vgaHWSymbols, NULL); if (!vgaHWGetHWRec(pScrn)) - return FALSE; + return FALSE; #if 0 /* Here we can alter the number of registers saved and restored by the @@ -609,24 +628,36 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) return FALSE; else { + int requiredBpp; + switch (pScrn->depth) { case 8: - case 15: case 16: + requiredBpp = pScrn->depth; + break; + case 15: + requiredBpp = 16; + break; case 24: - /* OK */ + requiredBpp = 32; break; + default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this driver\n", pScrn->depth); return FALSE; } + + if( pScrn->bitsPerPixel != requiredBpp ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Depth %d must specify %d bpp; %d was given\n", + pScrn->depth, requiredBpp, pScrn->bitsPerPixel ); + return FALSE; + } } - xf86PrintDepthBpp(pScrn); - if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); + xf86PrintDepthBpp(pScrn); if (pScrn->depth > 8) { rgb zeros = {0, 0, 0}; @@ -664,11 +695,13 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SavageOptions); - if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { - psav->pci_burst = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst read enabled\n"); - } else - psav->pci_burst = FALSE; + xf86GetOptValBool(SavageOptions, OPTION_PCI_BURST, &psav->pci_burst); + + if (psav->pci_burst) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Option: pci_burst - PCI burst read enabled\n"); + } + psav->NoPCIRetry = 1; /* default */ if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_RETRY, FALSE)) { if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { @@ -677,48 +710,26 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) } else xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option requires \"pci_burst\"\n"); } - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_CONSERV)) { - psav->fifo_conservative = TRUE; + + xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_conservative ); + if (psav->fifo_conservative) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo conservative set\n"); - } else - psav->fifo_conservative = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_MODERATE)) { - psav->fifo_moderate = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n"); - } else - psav->fifo_moderate = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_AGGRESSIVE)) { - psav->fifo_aggressive = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n"); - } else - psav->fifo_aggressive = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_EDODRAM)) { - psav->slow_edodram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_edodram_set\n"); - } else - psav->slow_edodram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_DRAM)) { - psav->slow_dram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_dram set\n"); - } else - psav->slow_dram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FAST_DRAM)) { - psav->fast_dram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fast_dram set\n"); - } else - psav->fast_dram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FPM_VRAM)) { - psav->fpm_vram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fpm_vram set\n"); - } else - psav->fpm_vram = FALSE; + } - if (xf86IsOptionSet(SavageOptions, OPTION_SHADOW_FB)) { - psav->shadowFB = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ShadowFB %s.\n", - psav->shadowFB ? "enabled" : "disabled"); - } else - psav->shadowFB = FALSE; + xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_moderate ); + if (psav->fifo_moderate) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo moderate set\n"); + } + + xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_aggressive ); + if (psav->fifo_aggressive) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo aggressive set\n"); + } + + xf86GetOptValBool( SavageOptions, OPTION_SHADOW_FB, &psav->shadowFB ); + if (psav->shadowFB) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n"); + } if ((s = xf86GetOptValString(SavageOptions, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { @@ -740,11 +751,9 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) } } - if (xf86ReturnOptValBool(SavageOptions, OPTION_NOACCEL, FALSE)) { - psav->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration Disabled\n"); - } else - psav->NoAccel = FALSE; + if (xf86GetOptValBool(SavageOptions, OPTION_NOACCEL, &psav->NoAccel)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: NoAccel - Acceleration Disabled\n"); if (psav->shadowFB && !psav->NoAccel) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -752,19 +761,14 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->NoAccel = TRUE; } - if (xf86ReturnOptValBool(SavageOptions, OPTION_EARLY_RAS_PRECHARGE, FALSE)) { - psav->early_ras_precharge = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: early_ras_precharge set\n"); - } else - psav->early_ras_precharge = FALSE; - /* * The SWCursor setting takes priority over HWCursor. The default - * if neither is specified is HW. + * if neither is specified is HW, unless ShadowFB is specified, + * then SW. */ from = X_DEFAULT; - psav->hwcursor = TRUE; + psav->hwcursor = psav->shadowFB ? FALSE : TRUE; if (xf86GetOptValBool(SavageOptions, OPTION_HWCURSOR, &psav->hwcursor)) from = X_CONFIG; if (xf86ReturnOptValBool(SavageOptions, OPTION_SWCURSOR, FALSE)) { @@ -776,20 +780,27 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) from = X_DEFAULT; psav->UseBIOS = TRUE; - if (xf86IsOptionSet(SavageOptions, OPTION_USEBIOS) ) - { + if (xf86GetOptValBool(SavageOptions, OPTION_USEBIOS, &psav->UseBIOS) ) from = X_CONFIG; - xf86GetOptValBool(SavageOptions, OPTION_USEBIOS, &psav->UseBIOS); - } xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n", psav->UseBIOS ? "U" : "Not u" ); + psav->LCDClock = 0.0; + if( xf86GetOptValFreq( SavageOptions, OPTION_LCDCLOCK, OPTUNITS_MHZ, &psav->LCDClock ) ) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: LCDClock %1.2f MHz\n", psav->LCDClock ); - /* DO OTHERS HERE LATER!!!!!!!!!!!!!! */ + psav->StatusDelay = 0; + if( xf86GetOptValInteger( SavageOptions, OPTION_STATUS_DELAY, &psav->StatusDelay ) ) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: StatusDelay %d microseconds\n", psav->StatusDelay ); - from = X_DEFAULT; + if( xf86GetOptValBool( SavageOptions, OPTION_STATUS_HACK, &psav->StatusHack)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: StatusHack enabled\n" ); + /* Add more options here. */ if (pScrn->numEntities > 1) { SavageFreeRec(pScrn); @@ -804,23 +815,23 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) } psav->EntityIndex = pEnt->index; - if (psav->UseBIOS) { - if (xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); - psav->pInt10 = xf86InitInt10(pEnt->index); - } + if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); + psav->pInt10 = xf86InitInt10(pEnt->index); + } - if (xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - psav->pVbe = VBEInit(psav->pInt10, pEnt->index); - } + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + psav->pVbe = VBEInit(psav->pInt10, pEnt->index); } + psav->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + from = X_DEFAULT; if (pEnt->device->chipset && *pEnt->device->chipset) { pScrn->chipset = pEnt->device->chipset; psav->ChipId = pEnt->device->chipID; @@ -842,6 +853,9 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->Chipset); } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chip: id %04x, \"%s\"\n", + psav->ChipId, xf86TokenToString( SavageChips, psav->ChipId ) ); + if (pEnt->device->chipRev >= 0) { psav->ChipRev = pEnt->device->chipRev; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", @@ -853,7 +867,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) /* maybe throw in some more sanity checks here */ - xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); + xf86DrvMsg(pScrn->scrnIndex, from, "Engine: \"%s\"\n", pScrn->chipset); psav->PciTag = pciTag(psav->PciInfo->bus, psav->PciInfo->device, psav->PciInfo->func); @@ -876,7 +890,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) /* unlock extended regs */ VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); VGAOUT8(vgaCRIndex, 0x40); @@ -917,6 +931,18 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) break; case S3_SAVAGE4: + /* + * The Savage4 has one ugly special case to consider. On + * systems with 4 banks of 2Mx32 SDRAM, the BIOS says 4MB + * when it really means 8MB. Why do it the same when you + * can do it different... + */ + VGAOUT8(vgaCRIndex, 0x68); /* memory control 1 */ + if( (VGAIN8(vgaCRReg) & 0xC0) == (0x01 << 6) ) + RamSavage4[1] = 8; + + /*FALLTHROUGH*/ + case S3_SAVAGE2000: pScrn->videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024; break; @@ -1002,7 +1028,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) VGAOUT8(vgaCRReg, cr66 & ~0x02); /* clear reset flag */ usleep(10000); - /* Set status word positions based on chip type. */ + /* Set status word positions based on chip type. */ switch( psav->Chipset ) { case S3_SAVAGE3D: @@ -1028,8 +1054,42 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->myWaitCommandEmpty = WaitCommandEmpty2K; break; } - - /* savage ramdac speeds */ + + /* Do the DDC dance. */ + + ddc = xf86LoadSubModule(pScrn, "ddc"); + if (ddc) { +#if 0 + xf86MonPtr pMon = NULL; +#endif + + xf86LoaderReqSymLists(ddcSymbols, NULL); +#if 0 +/* + * On many machines, the attempt to read DDC information via VBE puts the + * BIOS access into a state which prevents me from reading mode information. + * This is a complete mystery to me. + */ + if ((psav->pVbe) + && ((pMon = xf86PrintEDID(vbeDoEDID(psav->pVbe, ddc))) != NULL)) + xf86SetDDCproperties(pScrn,pMon); + else +#endif + if (!SavageDDC1(pScrn->scrnIndex)) { + if ( xf86LoadSubModule(pScrn, "i2c") ) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + if (SavageI2CInit(pScrn)) { + CARD32 tmp = (INREG(DDC_REG)); + OUTREG(DDC_REG,(tmp | 0x13)); + xf86SetDDCproperties(pScrn,xf86PrintEDID( + xf86DoEDID_DDC2(pScrn->scrnIndex,psav->I2C))); + OUTREG(DDC_REG,tmp); + } + } + } + } + + /* Savage ramdac speeds */ pScrn->numClocks = 4; pScrn->clock[0] = 250000; pScrn->clock[1] = 250000; @@ -1047,7 +1107,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->dacSpeedBpp = pScrn->clock[0]; } - /* set ramdac limits */ + /* Set ramdac limits */ psav->maxClock = psav->dacSpeedBpp; /* detect current mclk */ @@ -1067,25 +1127,99 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected current MCLK value of %1.3f MHz\n", mclk / 1000.0); - psav->minClock = 20000; + psav->minClock = 10000; - pScrn->maxHValue = 2048; - pScrn->maxVValue = 2048; + pScrn->maxHValue = 2048 << 3; /* 11 bits of h_total 8-pixel units */ + pScrn->maxVValue = 2048; /* 11 bits of v_total */ pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* Check LCD panel information */ + + if( psav->Chipset == S3_SAVAGE_MX ) + { + unsigned char cr6b = hwp->readCrtc( hwp, 0x6b ); + + int panelX = (hwp->readSeq(hwp, 0x61) + + ((hwp->readSeq(hwp, 0x66) & 0x02) << 7) + 1) * 8; + int panelY = hwp->readSeq(hwp, 0x69) + + ((hwp->readSeq(hwp, 0x6e) & 0x70) << 4) + 1; + + char * sTechnology = "Unknown"; + + /* OK, I admit it. I don't know how to limit the max dot clock + * for LCD panels of various sizes. I thought I copied the formula + * from the BIOS, but many users have informed me of my folly. + * + * Instead, I'll abandon any attempt to automatically limit the + * clock, and add an LCDClock option to XF86Config. Some day, + * I should come back to this. + */ + + enum ACTIVE_DISPLAYS { /* These are the bits in CR6B */ + ActiveCRT = 0x01, + ActiveLCD = 0x02, + ActiveTV = 0x04, + ActiveCRT2 = 0x20, + ActiveDUO = 0x80 + }; + + if( (hwp->readSeq( hwp, 0x39 ) & 0x03) == 0 ) + { + sTechnology = "TFT"; + } + else if( (hwp->readSeq( hwp, 0x30 ) & 0x01) == 0 ) + { + sTechnology = "DSTN"; + } + else + { + sTechnology = "STN"; + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%dx%d %s LCD panel detected %s\n", + panelX, panelY, sTechnology, + cr6b & ActiveLCD ? "and active" : "but not active"); + if( cr6b & ActiveLCD ) { + /* If the LCD is active and panel expansion is enabled, */ + /* we probably want to kill the HW cursor. */ + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "- Limiting video mode to %dx%d\n", + panelX, panelY ); + + if( pScrn->virtualX > panelX ) + pScrn->virtualX = panelX; + if( pScrn->virtualY > panelY ) + pScrn->virtualY = panelY; + + if( psav->LCDClock > 0.0 ) + { + psav->maxClock = psav->LCDClock * 1000.0; + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "- Limiting dot clock to %1.2f MHz\n", + psav->LCDClock ); + } + } + } + clockRanges = xnfalloc(sizeof(ClockRange)); clockRanges->next = NULL; clockRanges->minClock = psav->minClock; clockRanges->maxClock = psav->maxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = FALSE; + clockRanges->doubleScanAllowed = TRUE; + clockRanges->ClockDivFactor = 1.0; + clockRanges->ClockMulFactor = 1.0; i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, 16 * pScrn->bitsPerPixel, 128, 2048, - pScrn->virtualX, pScrn->display->virtualY, + pScrn->virtualX, pScrn->virtualY, psav->videoRambytes, LOOKUP_BEST_REFRESH); if (i == -1) { @@ -1111,15 +1245,14 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) SavageFreeBIOSModeTable( psav, &psav->ModeTable ); } - psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->depth ); + psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->bitsPerPixel ); if( !psav->ModeTable || !psav->ModeTable->NumModes ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to fetch any BIOS modes.\n"); - SavageFreeRec(pScrn); - return FALSE; + "Failed to fetch any BIOS modes. Disabling BIOS.\n"); + psav->UseBIOS = FALSE; } - + else /*if( xf86Verbose )*/ { int i; @@ -1151,28 +1284,12 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); - /* load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - reqSym = "cfbScreenInit"; - break; - case 16: - mod = "cfb16"; - reqSym = "cfb16ScreenInit"; - break; - case 32: - mod = "cfb32"; - reqSym = "cfb32ScreenInit"; - break; - } - - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { SavageFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols(reqSym, NULL); + xf86LoaderReqSymbols("fbScreenInit", NULL); if( !psav->NoAccel ) { if( !xf86LoadSubModule(pScrn, "xaa") ) { @@ -1205,7 +1322,10 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) static Bool SavageEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + TRACE(("SavageEnterVT(%d)\n", flags)); + gpScrn = pScrn; + SavageEnableMMIO(pScrn); SavageSave(pScrn); return SavageModeInit(pScrn, pScrn->currentMode); } @@ -1219,7 +1339,10 @@ static void SavageLeaveVT(int scrnIndex, int flags) vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavageRegPtr SavageSavePtr = &psav->SavedReg; - SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + TRACE(("SavageLeaveVT(%d)\n", flags)); + gpScrn = pScrn; + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); + SavageDisableMMIO(pScrn); } @@ -1235,9 +1358,10 @@ static void SavageSave(ScrnInfoPtr pScrn) vgaCRReg = vgaIOBase + 5; vgaCRIndex = vgaIOBase + 4; + TRACE(("SavageSave()\n")); VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); VGAOUT8(vgaCRIndex, 0x66); @@ -1371,10 +1495,12 @@ static void SavageSave(ScrnInfoPtr pScrn) VGAOUT8(vgaCRReg, cr3a | 0x80); /* now save MIU regs */ - save->MMPR0 = INREG(FIFO_CONTROL_REG); - save->MMPR1 = INREG(MIU_CONTROL_REG); - save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); - save->MMPR3 = INREG(MISC_TIMEOUT_REG); + if( psav->Chipset != S3_SAVAGE_MX ) { + save->MMPR0 = INREG(FIFO_CONTROL_REG); + save->MMPR1 = INREG(MIU_CONTROL_REG); + save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); + save->MMPR3 = INREG(MISC_TIMEOUT_REG); + } VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); @@ -1397,18 +1523,19 @@ static void SavageSave(ScrnInfoPtr pScrn) static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, - SavageRegPtr restore) + SavageRegPtr restore, Bool Entering) { unsigned char tmp, cr3a, cr66, cr67; vgaHWPtr hwp = VGAHWPTR(pScrn); SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; - Bool graphicsMode = FALSE; vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + + TRACE(("SavageWriteMode(%x)\n", restore->mode)); /* * If we figured out a VESA mode number for this timing, just use @@ -1447,15 +1574,18 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, /* Disable old MMIO. */ VGAOUT8(vgaCRIndex, 0x53); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp & ~0x10); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & ~0x10); + + /* Set the color mode. */ + + VGAOUT8(vgaCRIndex, 0x67); + VGAOUT8(vgaCRReg, restore->CR67); /* We may need TV/panel fixups here. See s3bios.c line 2904. */ /* Set FIFO fetch delay. */ VGAOUT8(vgaCRIndex, 0x85); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, (tmp & 0xf8) | 0x03); + VGAOUT8(vgaCRReg, (VGAIN8(vgaCRReg) & 0xf8) | 0x03); /* Patch CR79. These values are magical. */ @@ -1516,16 +1646,11 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, /* Enable the graphics engine. */ VGAOUT16(vgaCRIndex, 0x0140); - #if 0 - if( !psav->NoAccel ) - S3SAVInitialize2DEngine(); - #endif /* Handle the pitch. */ VGAOUT8(vgaCRIndex, 0x50); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0xC1); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 ); @@ -1533,22 +1658,23 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, /* Some non-S3 BIOSes enable block write even on non-SGRAM devices. */ - if( psav->Chipset == S3_SAVAGE2000 ) - { - VGAOUT8(vgaCRIndex, 0x73); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp & 0xdf ); - } - else if( psav->Chipset != S3_SAVAGE_MX ) + switch( psav->Chipset ) { - VGAOUT8(vgaCRIndex, 0x68); - if( !(VGAIN8(vgaCRReg) & 0x80) ) - { - /* Not SGRAM; disable block write. */ - VGAOUT8(vgaCRIndex, 0x88); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0x10); - } + case S3_SAVAGE2000: + VGAOUT8(vgaCRIndex, 0x73); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & 0xdf ); + break; + + case S3_SAVAGE3D: + case S3_SAVAGE4: + VGAOUT8(vgaCRIndex, 0x68); + if( !(VGAIN8(vgaCRReg) & 0x80) ) + { + /* Not SGRAM; disable block write. */ + VGAOUT8(vgaCRIndex, 0x88); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0x10); + } + break; } if( !psav->NoAccel ) @@ -1563,7 +1689,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(0x3c2, 0x23); VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); vgaHWProtect(pScrn, TRUE); @@ -1571,8 +1697,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, /* will we be reenabling STREAMS for the new mode? */ psav->STREAMSRunning = 0; - graphicsMode = (restore->CR31 & 0x0a) ? TRUE : FALSE; - /* reset GE to make sure nothing is going on */ VGAOUT8(vgaCRIndex, 0x66); if(VGAIN8(vgaCRReg) & 0x01) @@ -1585,14 +1709,8 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, * switch to mode 3 here seems to eliminate the issue. */ -#define CLEAR_X86_REGS(pi) \ - (pi)->ax = (pi)->bx = (pi)->cx = (pi)->dx = (pi)->si = (pi)->di = 0 - - if( !graphicsMode && psav->pInt10 ) { - CLEAR_X86_REGS( psav->pInt10 ); - psav->pInt10->num = 0x10; - psav->pInt10->ax = 0x0083; - xf86ExecX86int10( psav->pInt10 ); + if( ((restore->CR31 & 0x0a) == 0) && psav->pInt10 ) { + SavageSetTextMode( psav ); } VGAOUT8(vgaCRIndex, 0x67); @@ -1758,26 +1876,28 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, cr3a = VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, cr3a | 0x80); - if (graphicsMode) + if (psav->Entering) SavageGEReset(pScrn,0,__LINE__,__FILE__); - VerticalRetraceWait(); - OUTREG(FIFO_CONTROL_REG, restore->MMPR0); - WaitIdle(); - OUTREG(MIU_CONTROL_REG, restore->MMPR1); - WaitIdle(); - OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); - WaitIdle(); - OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); + if( psav->Chipset != S3_SAVAGE_MX ) + { + VerticalRetraceWait(); + OUTREG(FIFO_CONTROL_REG, restore->MMPR0); + WaitIdle(); + OUTREG(MIU_CONTROL_REG, restore->MMPR1); + WaitIdle(); + OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); + WaitIdle(); + OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); + } /* If we're going into graphics mode and acceleration was enabled, */ /* go set up the BCI buffer and the global bitmap descriptor. */ - if( graphicsMode && (!psav->NoAccel) ) + if( psav->Entering && (!psav->NoAccel) ) { VGAOUT8(vgaCRIndex, 0x50); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0xC1); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); SavageInitialize2DEngine(pScrn); } @@ -1786,7 +1906,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); - if( graphicsMode ) + if( psav->Entering ) SavageSetGBD(pScrn); vgaHWProtect(pScrn, FALSE); @@ -1800,6 +1920,8 @@ static Bool SavageMapMMIO(ScrnInfoPtr pScrn) SavagePtr psav; vgaHWPtr hwp; + TRACE(("SavageMapMMIO()\n")); + psav = SAVPTR(pScrn); if( S3_SAVAGE3D_SERIES(psav->Chipset) ) { @@ -1845,6 +1967,8 @@ static Bool SavageMapFB(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); + TRACE(("SavageMapFB()\n")); + xf86DrvMsg( pScrn->scrnIndex, X_PROBED, "mapping framebuffer @ 0x%x with size 0x%x\n", psav->FrameBufferBase, psav->videoRambytes); @@ -1868,24 +1992,33 @@ static Bool SavageMapFB(ScrnInfoPtr pScrn) } -static void SavageUnmapMem(ScrnInfoPtr pScrn) +static void SavageUnmapMem(ScrnInfoPtr pScrn, int All) { SavagePtr psav; psav = SAVPTR(pScrn); + TRACE(("SavageUnmapMem(%x,%x)\n", psav->MapBase, psav->FBBase)); + if (psav->PrimaryVidMapped) { vgaHWUnmapMem(pScrn); psav->PrimaryVidMapped = FALSE; } SavageDisableMMIO(pScrn); - if (psav->MapBase) + + if (All && psav->MapBase) { xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBase, SAVAGE_NEWMMIO_REGSIZE); - if (psav->FBBase) + psav->MapBase = 0; + } + + if (psav->FBBase) { xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->FBBase, psav->videoRambytes); + psav->FBBase = 0; + } + #if 0 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBaseDense, 0x8000); @@ -1902,9 +2035,13 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, SavagePtr psav; int ret; + TRACE(("SavageScreenInit()\n")); + pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); + SavageEnableMMIO(pScrn); + if (!SavageMapFB(pScrn)) return FALSE; @@ -1921,10 +2058,18 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; +#if 0 + if (!miSetPixmapDepths ()) + return FALSE; +#endif } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; +#if 0 + if (!miSetPixmapDepths ()) + return FALSE; +#endif } ret = SavageInternalScreenInit(scrnIndex, pScreen); @@ -1956,9 +2101,8 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); -#if 0 - SavageDGAInit(pScreen); -#endif + if( !psav->numDGAModes ) + SavageDGAInit(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -2002,9 +2146,12 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, pScreen->SaveScreen = SavageSaveScreen; pScreen->CloseScreen = SavageCloseScreen; -#ifdef DPMSExtension if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); + +#ifdef XvExtension + if( !psav->NoAccel ) + SavageInitVideo( pScreen ); #endif if (serverGeneration == 1) @@ -2022,6 +2169,8 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) int width, height, displayWidth; unsigned char *FBStart; + TRACE(("SavageInternalScreenInit()\n")); + pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); @@ -2046,29 +2195,12 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) FBStart = psav->FBStart; } - switch (pScrn->bitsPerPixel) { - case 8: - ret = cfbScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - case 16: - ret = cfb16ScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - case 32: - ret = cfb32ScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - default: - xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in SavageScreenInit\n", - pScrn->bitsPerPixel); - ret = FALSE; - break; - } + ret = fbScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, + displayWidth, + pScrn->bitsPerPixel); + if (ret) + fbPictureInit (pScreen, 0, 0); return ret; } @@ -2078,6 +2210,7 @@ static ModeStatus SavageValidMode(int index, DisplayModePtr mode, Bool verbose, int flags) { /* TODO check modes */ + TRACE(("SavageValidMode\n")); return MODE_OK; } @@ -2096,6 +2229,9 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + TRACE(("SavageModeInit(%dx%d, %dHz)\n", + mode->HDisplay, mode->VDisplay, mode->Clock)); + #if 0 ErrorF("Clock = %d, HDisplay = %d, HSStart = %d\n", mode->Clock, mode->HDisplay, mode->HSyncStart); @@ -2139,6 +2275,35 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->mode = 0; + /* We need to set CR67 whether or not we use the BIOS. */ + + dclk = mode->Clock; + new->CR67 = 0x00; + + switch( pScrn->depth ) { + case 8: + if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) + new->CR67 = 0x10; /* 8bpp, 135Mhz */ + else + new->CR67 = 0x00; /* 8bpp, 220Mhz */ + break; + case 15: + if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) + new->CR67 = 0x20; /* 15bpp, 135Mhz */ + else + new->CR67 = 0x30; /* 15bpp, 220Mhz */ + break; + case 16: + if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) + new->CR67 = 0x40; /* 16bpp, 135Mhz */ + else + new->CR67 = 0x50; /* 16bpp, 220Mhz */ + break; + case 24: + new->CR67 = 0xd0; + break; + } + if( psav->UseBIOS ) { int refresh; SavageModeEntryPtr pmt; @@ -2222,8 +2387,6 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->CR55 |= 0x10; #endif - dclk = mode->Clock; - new->CR67 = 0x00; new->SR15 = 0x03 | 0x80; new->SR18 = 0x00; new->CR43 = new->CR45 = new->CR65 = 0x00; @@ -2250,31 +2413,6 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) psav->NeedSTREAMS = FALSE; - /**** - * TODO - * old code uses the "dclk<=110000" path for all non-MX/IX, and the - * >110000 path for MX/IX. What does this mean? - ****/ - - if (pScrn->bitsPerPixel == 8) { - if (dclk <= 110000) - new->CR67 = 0x00; /* 8bpp, 135Mhz */ - else - new->CR67 = 0x10; /* 8bpp, 220Mhz */ - } else if ((pScrn->bitsPerPixel == 16) && (pScrn->weight.green == 5)) { - if (dclk <= 110000) - new->CR67 = 0x20; /* 15bpp, 135Mhz */ - else - new->CR67 = 0x30; /* 15bpp, 220Mhz */ - } else if (pScrn->bitsPerPixel == 16) { - if (dclk <= 110000) - new->CR67 = 0x40; /* 16bpp, 135Mhz */ - else - new->CR67 = 0x50; /* 16bpp, 220Mhz */ - } else if (pScrn->bitsPerPixel == 32) { - new->CR67 = 0xd0; - } - SavageCalcClock(dclk, 1, 1, 127, 0, 4, 180000, 360000, &m, &n, &r); new->SR12 = (r << 6) | (n & 0x3f); @@ -2342,17 +2480,17 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) else new->CR50 = 0x30; - if (pScrn->displayWidth <= 640) + if (pScrn->displayWidth == 640) new->CR50 |= 0x40; - else if (pScrn->displayWidth <= 800) + else if (pScrn->displayWidth == 800) new->CR50 |= 0x80; - else if (pScrn->displayWidth <= 1024) + else if (pScrn->displayWidth == 1024) new->CR50 |= 0x00; - else if (pScrn->displayWidth <= 1152) + else if (pScrn->displayWidth == 1152) new->CR50 |= 0x01; - else if (pScrn->displayWidth <= 1280) + else if (pScrn->displayWidth == 1280) new->CR50 |= 0xc0; - else if (pScrn->displayWidth <= 1600) + else if (pScrn->displayWidth == 1600) new->CR50 |= 0x81; else new->CR50 |= 0xc1; /* Use GBD */ @@ -2382,7 +2520,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->vtSema = TRUE; /* do it! */ - SavageWriteMode(pScrn, vganew, new); + SavageWriteMode(pScrn, vganew, new, TRUE); SavageAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; @@ -2397,28 +2535,17 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavageRegPtr SavageSavePtr = &psav->SavedReg; + TRACE(("SavageCloseScreen\n")); + if( psav->AccelInfoRec ) { XAADestroyInfoRec( psav->AccelInfoRec ); psav->AccelInfoRec = NULL; } -#if 0 - if( psav->pInt10 ) { - xf86FreeInt10( psav->pInt10 ); - psav->pInt10 = NULL; - } - - if (psav->pVbe) - { - vbeFree(psav->pVbe); - psav->pVbe = NULL; - } -#endif - if (pScrn->vtSema) { - SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); vgaHWLock(hwp); - SavageUnmapMem(pScrn); + SavageUnmapMem(pScrn, 0); } pScrn->vtSema = FALSE; @@ -2430,6 +2557,17 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TRACE(("SavageSaveScreen(0x%x)\n", mode)); + + if( SAVPTR(pScrn)->hwcursor ) + { + if( xf86IsUnblank(mode) ) + SavageShowCursor( pScrn ); + else + SavageHideCursor( pScrn ); + } + return vgaHWSaveScreen(pScreen, mode); } @@ -2445,10 +2583,12 @@ void SavageAdjustFrame(int scrnIndex, int x, int y, int flags) vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + TRACE(("SavageAdjustFrame(%d,%d,%x)\n", x, y, flags)); + if (psav->ShowCache && y) y += pScrn->virtualY - 1; - Base = ((y * pScrn->displayWidth + x) * + Base = ((y * pScrn->displayWidth + (x&~1)) * (pScrn->bitsPerPixel / 8)) >> 2; /* now program the start address registers */ VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c); @@ -2462,6 +2602,7 @@ void SavageAdjustFrame(int scrnIndex, int x, int y, int flags) Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + TRACE(("SavageSwitchMode\n")); return SavageModeInit(xf86Screens[scrnIndex], mode); } @@ -2473,6 +2614,9 @@ void SavageEnableMMIO(ScrnInfoPtr pScrn) int vgaCRIndex, vgaCRReg; unsigned char val; + TRACE(("SavageEnableMMIO\n")); + + vgaHWSetStdFuncs(hwp); vgaHWSetMmioFuncs(hwp, psav->MapBase, 0x8000); val = VGAIN8(0x3c3); VGAOUT8(0x3c3, val | 0x01); @@ -2482,9 +2626,12 @@ void SavageEnableMMIO(ScrnInfoPtr pScrn) vgaCRIndex = hwp->IOBase + 4; vgaCRReg = hwp->IOBase + 5; - VGAOUT8(vgaCRIndex, 0x40); - val = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, val | 1); + if( psav->Chipset >= S3_SAVAGE4 ) + { + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + } return; } @@ -2497,13 +2644,20 @@ void SavageDisableMMIO(ScrnInfoPtr pScrn) int vgaCRIndex, vgaCRReg; unsigned char val; + TRACE(("SavageDisableMMIO\n")); + vgaHWGetIOBase(hwp); vgaCRIndex = hwp->IOBase + 4; vgaCRReg = hwp->IOBase + 5; - VGAOUT8(vgaCRIndex, 0x40); - val = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, val | 1); + if( psav->Chipset >= S3_SAVAGE4 ) + { + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + } + + vgaHWSetStdFuncs(hwp); return; } @@ -2527,6 +2681,9 @@ void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, + + /* Make sure linear addressing is enabled after the BIOS call. */ + /* Note that we must use an I/O port to do this. */ int min_n2, int max_n2, long freq_min, long freq_max, unsigned int *mdiv, unsigned int *ndiv, unsigned int *r) @@ -2592,6 +2749,8 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; + TRACE(("SavageGEReset(%d,%s)\n", line, file)); + vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; @@ -2603,7 +2762,7 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) } else WaitIdleEmpty(); - if (from_timeout) { + if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { fifo_control = INREG(FIFO_CONTROL_REG); miu_control = INREG(MIU_CONTROL_REG); streams_timeout = INREG(STREAMS_TIMEOUT_REG); @@ -2647,7 +2806,7 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) break; } - if (from_timeout) { + if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { OUTREG(FIFO_CONTROL_REG, fifo_control); OUTREG(MIU_CONTROL_REG, miu_control); OUTREG(STREAMS_TIMEOUT_REG, streams_timeout); @@ -2700,12 +2859,13 @@ SavagePrintRegs(ScrnInfoPtr pScrn) } -#ifdef DPMSExtension static void SavageDPMS(ScrnInfoPtr pScrn, int mode, int flags) { SavagePtr psav = SAVPTR(pScrn); unsigned char sr8 = 0x00, srd = 0x00; + TRACE(("SavageDPMS(%d,%x)\n", mode, flags)); + VGAOUT8(0x3c4, 0x08); sr8 = VGAIN8(0x3c5); sr8 |= 0x06; @@ -2738,4 +2898,53 @@ static void SavageDPMS(ScrnInfoPtr pScrn, int mode, int flags) return; } -#endif /* DPMSExtension */ + + +static unsigned int +SavageDDC1Read(ScrnInfoPtr pScrn) +{ + register vgaHWPtr hwp = VGAHWPTR(pScrn); + register CARD32 tmp; + SavagePtr psav = SAVPTR(pScrn); + + while (hwp->readST01(hwp)&0x8) {}; + while (!(hwp->readST01(hwp)&0x8)) {}; + + tmp = (INREG(DDC_REG)); + return ((unsigned int) (tmp & 0x08)); +} + +static Bool +SavageDDC1(int scrnIndex) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SavagePtr psav = SAVPTR(pScrn); + CARD32 tmp; + Bool success = FALSE; + xf86MonPtr pMon; + + /* initialize chipset */ + tmp = INREG(DDC_REG); + OUTREG(DDC_REG,(tmp | 0x12)); + + if ((pMon = xf86PrintEDID( + xf86DoEDID_DDC1(scrnIndex,vgaHWddc1SetSpeed,SavageDDC1Read))) != NULL) + success = TRUE; + xf86SetDDCproperties(pScrn,pMon); + + /* undo initialization */ + OUTREG(DDC_REG,(tmp)); + return success; +} + + +static void +SavageProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL,index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + } +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h index d05cdb19e..24929fb6c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h @@ -1,32 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.3 2000/12/07 20:26:22 dawes Exp $ */ +/* $xFree86: $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H +#include "xf86_ansic.h" +#include "compiler.h" #include "vgaHW.h" #include "xf86.h" #include "xf86Resources.h" -#include "xf86_ansic.h" #include "xf86Pci.h" #include "xf86PciInfo.h" #include "xf86_OSproc.h" -#include "compiler.h" #include "xf86Cursor.h" #include "mipointer.h" #include "micmap.h" -#include "cfb.h" -#include "cfb16.h" -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" #include "vbe.h" #include "xaa.h" +#include "xf86xv.h" #include "savage_regs.h" #define VGAIN8(addr) MMIO_IN8(psav->MapBase+0x8000, addr) #define VGAIN16(addr) MMIO_IN16(psav->MapBase+0x8000, addr) #define VGAIN(addr) MMIO_IN32(psav->MapBase+0x8000, addr) - + #define VGAOUT8(addr,val) MMIO_OUT8(psav->MapBase+0x8000, addr, val) #define VGAOUT16(addr,val) MMIO_OUT16(psav->MapBase+0x8000, addr, val) #define VGAOUT(addr,val) MMIO_OUT32(psav->MapBase+0x8000, addr, val) @@ -79,6 +78,7 @@ typedef struct _Savage { Bool STREAMSRunning; int Bpp, Bpl, ScissB; unsigned PlaneMask; + I2CBusPtr I2C; int videoRambytes; int videoRamKbytes; @@ -112,16 +112,14 @@ typedef struct _Savage { Bool fifo_conservative; Bool fifo_moderate; Bool fifo_aggressive; - Bool slow_edodram; - Bool slow_dram; - Bool fast_dram; - Bool fpm_vram; - Bool early_ras_precharge; Bool hwcursor; Bool NoAccel; Bool shadowFB; Bool UseBIOS; int rotate; + double LCDClock; + int StatusDelay; + Bool StatusHack; CloseScreenProcPtr CloseScreen; pciVideoPtr PciInfo; @@ -153,6 +151,7 @@ typedef struct _Savage { unsigned int SavedGbd; unsigned int SavedSbdOffset; unsigned int SavedSbd; + Bool Entering; /* Support for Int10 processing */ xf86Int10InfoPtr pInt10; @@ -163,8 +162,27 @@ typedef struct _Savage { unsigned long cobSize; /* size in bytes */ unsigned long cobOffset; /* offset in frame buffer */ + /* Support for DGA */ + int numDGAModes; + DGAModePtr DGAModes; + Bool DGAactive; + int DGAViewportStatus; + + /* Support for XVideo */ + + unsigned int videoFlags; + unsigned int blendBase; + int videoFourCC; + XF86VideoAdaptorPtr adaptor; + int VideoZoomMax; + } SavageRec, *SavagePtr; +/* Video flags. */ + +#define VF_STREAMS_ON 0x0001 + + /* Shortcuts. These depend on a local symbol "psav". */ #define WaitIdle() psav->myWaitIdle(psav) @@ -186,12 +204,19 @@ Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); /* In savage_cursor.c. */ Bool SavageHWCursorInit(ScreenPtr pScreen); +void SavageShowCursor(ScrnInfoPtr); +void SavageHideCursor(ScrnInfoPtr); /* In savage_accel.c. */ Bool SavageInitAccel(ScreenPtr); void SavageInitialize2DEngine(ScrnInfoPtr); void SavageSetGBD(ScrnInfoPtr); +void SavageAccelSync(ScrnInfoPtr); + +/* In savage_i2c.c. */ + +Bool SavageI2CInit(ScrnInfoPtr pScrn); /* In savage_shadow.c */ @@ -215,5 +240,9 @@ unsigned short SavageGetBIOSModes( SavageModeEntryPtr s3vModeTable ); +/* In savage_video.c */ + +void SavageInitVideo( ScreenPtr pScreen ); + #endif /* SAVAGE_VGAHWMMIO_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h index 679795c8d..c730eb290 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h @@ -1,9 +1,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.4 2000/12/07 20:26:22 dawes Exp $ */ - #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H -#include "savage_driver.h" +/* These are here until xf86PciInfo.h is updated. */ + +#ifndef PCI_CHIP_TWISTER_P +#define PCI_CHIP_TWISTER_P 0x8d01 +#endif +#ifndef PCI_CHIP_TWISTER_K +#define PCI_CHIP_TWISTER_K 0x8d02 +#endif #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) @@ -41,28 +46,95 @@ enum S3CHIPTAGS { #define STREAMS_TIMEOUT_REG 0x8208 #define MISC_TIMEOUT_REG 0x820c -#define PSTREAM_CONTROL_REG 0x8180 -#define COL_CHROMA_KEY_CONTROL_REG 0x8184 -#define SSTREAM_CONTROL_REG 0x8190 -#define CHROMA_KEY_UPPER_BOUND_REG 0x8194 -#define SSTREAM_STRETCH_REG 0x8198 -#define BLEND_CONTROL_REG 0x81a0 -#define PSTREAM_FBADDR0_REG 0x81c0 -#define PSTREAM_FBADDR1_REG 0x81c4 -#define PSTREAM_STRIDE_REG 0x81c8 -#define DOUBLE_BUFFER_REG 0x81cc -#define SSTREAM_FBADDR0_REG 0x81d0 -#define SSTREAM_FBADDR1_REG 0x81d4 -#define SSTREAM_STRIDE_REG 0x81d8 -#define OPAQUE_OVERLAY_CONTROL_REG 0x81dc -#define K1_VSCALE_REG 0x81e0 -#define K2_VSCALE_REG 0x81e4 -#define DDA_VERT_REG 0x81e8 -#define STREAMS_FIFO_REG 0x81ec -#define PSTREAM_START_REG 0x81f0 -#define PSTREAM_WINDOW_SIZE_REG 0x81f4 -#define SSTREAM_START_REG 0x81f8 -#define SSTREAM_WINDOW_SIZE_REG 0x81fC +/* Stream Processor 1 */ + +/* Primary Stream 1 Frame Buffer Address 0 */ +#define PRI_STREAM_FBUF_ADDR0 0x81c0 +/* Primary Stream 1 Frame Buffer Address 0 */ +#define PRI_STREAM_FBUF_ADDR1 0x81c4 +/* Primary Stream 1 Stride */ +#define PRI_STREAM_STRIDE 0x81c8 +/* Primary Stream 1 Frame Buffer Size */ +#define PRI_STREAM_BUFFERSIZE 0x8214 + +/* Secondary stream 1 Color/Chroma Key Control */ +#define SEC_STREAM_CKEY_LOW 0x8184 +/* Secondary stream 1 Chroma Key Upper Bound */ +#define SEC_STREAM_CKEY_UPPER 0x8194 +/* Blend Control of Secondary Stream 1 & 2 */ +#define BLEND_CONTROL 0x8190 +/* Secondary Stream 1 Color conversion/Adjustment 1 */ +#define SEC_STREAM_COLOR_CONVERT1 0x8198 +/* Secondary Stream 1 Color conversion/Adjustment 2 */ +#define SEC_STREAM_COLOR_CONVERT2 0x819c +/* Secondary Stream 1 Color conversion/Adjustment 3 */ +#define SEC_STREAM_COLOR_CONVERT3 0x81e4 +/* Secondary Stream 1 Horizontal Scaling */ +#define SEC_STREAM_HSCALING 0x81a0 +/* Secondary Stream 1 Frame Buffer Size */ +#define SEC_STREAM_BUFFERSIZE 0x81a8 +/* Secondary Stream 1 Horizontal Scaling */ +#define SEC_STREAM_VSCALING 0x81e8 +/* Secondary Stream 1 Frame Buffer Address 0 */ +#define SEC_STREAM_FBUF_ADDR0 0x81d0 +/* Secondary Stream 1 Frame Buffer Address 1 */ +#define SEC_STREAM_FBUF_ADDR1 0x81d4 +/* Secondary Stream 1 Frame Buffer Address 2 */ +#define SEC_STREAM_FBUF_ADDR2 0x81ec +/* Secondary Stream 1 Stride */ +#define SEC_STREAM_STRIDE 0x81d8 +/* Secondary Stream 1 Window Start Coordinates */ +#define SEC_STREAM_WINDOW_START 0x81f8 +/* Secondary Stream 1 Window Size */ +#define SEC_STREAM_WINDOW_SZ 0x81fc +/* Secondary Streams Tile Offset */ +#define SEC_STREAM_TILE_OFF 0x821c +/* Secondary Stream 1 Opaque Overlay Control */ +#define SEC_STREAM_OPAQUE_OVERLAY 0x81dc + + +/* Stream Processor 2 */ + +/* Primary Stream 2 Frame Buffer Address 0 */ +#define PRI_STREAM2_FBUF_ADDR0 0x81b0 +/* Primary Stream 2 Frame Buffer Address 1 */ +#define PRI_STREAM2_FBUF_ADDR1 0x81b4 +/* Primary Stream 2 Stride */ +#define PRI_STREAM2_STRIDE 0x81b8 +/* Primary Stream 2 Frame Buffer Size */ +#define PRI_STREAM2_BUFFERSIZE 0x8218 + +/* Secondary Stream 2 Color/Chroma Key Control */ +#define SEC_STREAM2_CKEY_LOW 0x8188 +/* Secondary Stream 2 Chroma Key Upper Bound */ +#define SEC_STREAM2_CKEY_UPPER 0x818c +/* Secondary Stream 2 Horizontal Scaling */ +#define SEC_STREAM2_HSCALING 0x81a4 +/* Secondary Stream 2 Horizontal Scaling */ +#define SEC_STREAM2_VSCALING 0x8204 +/* Secondary Stream 2 Frame Buffer Size */ +#define SEC_STREAM2_BUFFERSIZE 0x81ac +/* Secondary Stream 2 Frame Buffer Address 0 */ +#define SEC_STREAM2_FBUF_ADDR0 0x81bc +/* Secondary Stream 2 Frame Buffer Address 1 */ +#define SEC_STREAM2_FBUF_ADDR1 0x81e0 +/* Secondary Stream 2 Frame Buffer Address 2 */ +#define SEC_STREAM2_FBUF_ADDR2 0x8208 +/* Multiple Buffer/LPB and Secondary Stream 2 Stride */ +#define SEC_STREAM2_STRIDE_LPB 0x81cc +/* Secondary Stream 2 Color conversion/Adjustment 1 */ +#define SEC_STREAM2_COLOR_CONVERT1 0x81f0 +/* Secondary Stream 2 Color conversion/Adjustment 2 */ +#define SEC_STREAM2_COLOR_CONVERT2 0x81f4 +/* Secondary Stream 2 Color conversion/Adjustment 3 */ +#define SEC_STREAM2_COLOR_CONVERT3 0x8200 +/* Secondary Stream 2 Window Start Coordinates */ +#define SEC_STREAM2_WINDOW_START 0x820c +/* Secondary Stream 2 Window Size */ +#define SEC_STREAM2_WINDOW_SZ 0x8210 +/* Secondary Stream 2 Opaque Overlay Control */ +#define SEC_STREAM2_OPAQUE_OVERLAY 0x8180 + #define SUBSYS_STAT_REG 0x8504 @@ -74,6 +146,8 @@ enum S3CHIPTAGS { #define MONO_PAT_0 0xa4e8 #define MONO_PAT_1 0xa4ec +#define DDC_REG 0xff20 + /* Constants for CR69. */ @@ -99,7 +173,6 @@ enum S3CHIPTAGS { { \ VGAOUT8(vgaCRIndex, 0x17); \ if (VGAIN8(vgaCRReg) & 0x80) { \ - while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ } \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README index c7ed98328..d2f142d68 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README @@ -21,6 +21,7 @@ Display: - "Rotate" "cw" | "ccw" Rotate the screen CW - clockwise or CCW - counter clockwise. Uses ShadowFB. Default: no rotation. - "UseBIOS" Use BIOS to set modes. Default: on. +- "ZoomOnLCD" Allow changing resolution on panel. Default: off. Overlays: @@ -72,4 +73,4 @@ Debug: Header: //Mercury/Projects/archives/XFree86/4.0/README.-arc 1.2 14 Sep 2000 12:28:36 Frido $ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.2 2000/12/05 21:18:37 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.3 2001/02/15 18:20:33 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt index a9448ee81..af828eb31 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt @@ -1,5 +1,41 @@ + -------------------------------------------------------------------------------- - Silicon Motion Driver for XFree86 4.0.1 + Silicon Motion Driver for XFree86 4.0.2 + Alpha Release 1.2.2, 02/14/2001 +------------------------------------------------------------------------------- + +Fixed bugs: + +- #920 - Color change/flash at 8bpp when switch back to desktop in rotation + mode. +- #932 - System hangs when enabling rotation in 24-bpp. +- #941 - Overlay disappear in the virtual desktop when move the window. +- #944 - Mouse pointer doesn't work properly in panning modes under rotation. +- #950 - Garbage appears on desktop when click the Basic/Metal for the Theme + Selector. +- #983 - Added ZoomOnLCD option. +- #1058 - Desktop changes color when panning in 24-bpp mode. +- #1069 - CRT is off after exit X on DSTN 800x600. +- #1074 - Screen broken occurs in X when enable Rotation on DSTN 800x600. + +Known problems: + +- When video is playing in panning mode, it is not correctly clipped when you + move the panning window. +- Sound breaks apart in Netscape when moving the window around. + +------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.0.2 + Alpha Release 1.2.1, 01/03/2001 +-------------------------------------------------------------------------------- + +Fixed bugs: + +- Severe corruption in 24-bpp across all chips. +- Disable hardware cursor on older BIOSes. + +-------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.0.2 Alpha Release 1.2.0, 12/13/2000 -------------------------------------------------------------------------------- @@ -148,6 +184,6 @@ This driver has been tested on the LynxEM+ 712 chip under 16-bit mode. Any other mode might still show lock-ups and/or garbage. Please report any problems to frido@siliconmotion.com. -Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.30 30 Nov 2000 17:00:58 Frido $ +Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.33 13 Dec 2000 09:52:48 Frido $ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.3 2000/12/14 01:05:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.5 2001/02/15 18:20:33 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp deleted file mode 100644 index 43ab525f7..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp +++ /dev/null @@ -1,195 +0,0 @@ -.\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp,v 1.4 2000/12/12 18:54:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH siliconmotion __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -siliconmotion \- Silicon Motion video driver -.SH SYNOPSIS -.B "Section \*qDevice\*q" -.br -.BI " Identifier \*q" devname \*q -.br -.B " Driver \*qsiliconmotion\*q" -.br -\ \ ... -.br -\ \ [ -.B "Option" -"optionname" ["optionvalue"]] -.br -.B EndSection -.SH DESCRIPTION -.B siliconmotion -is an XFree86 driver for Silicon Motion based video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 16, and 24. All -visual types are supported for depth 8, and TrueColor -visuals are supported for the other depths. -.SH SUPPORTED HARDWARE -The -.B siliconmotion -driver supports PCI and AGP video cards based on the following Silicon Motion chips: -.TP 12 -.B Lynx -SM910 -.TP 12 -.B LynxE -SM810 -.TP 12 -.B Lynx3D -SM820 -.TP 12 -.B LynxEM -SM710 -.TP 12 -.B LynxEM+ -SM712 -.TP 12 -.B Lynx3DM -SM720 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. All options names are case and white space insensitive when -parsed by the server, for example, "lynxe" and "LynxE" are equivalent. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm". -.RE - -.PP -The following Cursor -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Inverse of "HWCursor". Default: off. - -.PP -The following display -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Use shadow framebuffer. Default: off. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the screen CW - clockwise or CCW - counter clockwise. -Uses ShadowFB. Default: no rotation. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -Set the video color key. Default: a little off full blue. -.TP -.BI "Option \*qByteSwap\*q \*q" boolean \*q -Turn on byte swapping for capturing using SMI demo board. Default: off. -.TP -.BI "Option \*qUseBIOS\*q \*q" boolean \*q -Use the BIOS to set the modes. This is used for custom panel timings. -Default: on. - -.PP -The following video memory -.B Options -are supported: -.TP -.BI "Option \*qset_mclk\*q \*q" integer \*q -sets the memory clock, where -.I integer -is in kHz, and -.I integer -<= 100000. Default: probe the memory clock value, -and use it at server start. - - -.PP -The following acceleration and graphics engine -.B Options -are supported: -.TP -.B "Option \*qNoAccel\*q" -Disable acceleration. Very useful for determining if the -driver has problems with drawing and acceleration routines. This is the first -option to try if your server runs but you see graphic corruption on the screen. -Using it decreases performance, as it uses software emulation for drawing -operations the video driver can accelerate with hardware. -Default: acceleration is enabled. -.TP -.B "Option \*qfifo_aggressive\*q" -.TP -.B "Option \*qfifo_moderate\*q" -.TP -.B "Option \*qfifo_conservative\*q" -alter the settings -for the threshold at which the pixel FIFO takes over the internal -memory bus to refill itself. The smaller this threshold, the better -the acceleration performance of the card. You may try the fastest -setting -.RB ( "fifo_aggressive" ) -and move down if you encounter pixel corruption. -The optimal setting will probably depend on dot-clock and on color -depth. Note that specifying any of these options will also alter other -memory settings which may increase performance, so trying -.B "fifo_conservative" -will in most cases be a slight benefit (this uses the chip defaults). -If pixel corruption or transient streaking is observed during drawing -operations then removing any fifo options is recommended. Default: none. - -.PP -The following PCI bus -.B Options -are supported: -.TP -.BI "Option \*qpci_burst\*q \*q" boolean \*q -will enable PCI burst mode. This should work on all but a -few broken PCI chipsets, and will increase performance. Default: off. -.TP -.BI "Option \*qpci_retry\*q \*q" boolean \*q -will allow the driver to rely on PCI Retry to program the -ViRGE registers. -.B "pci_burst" -must be enabled for this to work. -This will increase performance, especially for small fills/blits, -because the driver does not have to poll the ViRGE before sending it -commands to make sure it is ready. It should work on most -recent PCI chipsets. Default: off. - -.PP -The following additional -.B Options -are supported: -.TP -.BI "Option \*qShowCache\*q \*q" boolean \*q -Enable or disable viewing offscreen cache memory. A -development debug option. Default: off. - -.SH SEE ALSO -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) - -.SH SUPPORT -For assistance with this driver, or XFree86 in general, check the XFree86 web -site at http://www.xfree86.org. A FAQ is available on the web site at -http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a -question not answered in the FAQ please use our bug report form available on -the web site or send mail to XFree86@XFree86.org. When reporting problems -with the driver send as much detail as possible, including chipset type, a -server output log, and operating system specifics. - -.SH AUTHORS -Kevin Brosius, -Matt Grossman, -Harald Koenig, -Sebastien Marineau, -Mark Vojkovich, -Frido Garritsen. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h index dbe80934e..6c48ddf9f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.3 2001/02/15 18:20:33 dawes Exp $ */ #ifndef _SMI_H #define _SMI_H @@ -154,6 +154,7 @@ typedef struct Bool hwcursor; /* hardware cursor enabled */ Bool ShowCache; /* Debugging option */ Bool useBIOS; /* USe BIOS for mode sets */ + Bool zoomOnLCD; /* Zoom on LCD */ CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped * * CloseScreen function. */ @@ -196,6 +197,7 @@ typedef struct void * pSaveBuffer; /* #670 - FB save buffer */ CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ CARD32 savedFBReserved; /* #670 - Saved FBReserved value */ + CARD8 * paletteBuffer; /* #920 - Palette save buffer */ /* Polylines - #671 */ ValidateGCProcPtr ValidatePolylines;/* Org. ValidatePolylines function */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c index 516b22d29..7712742a3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c @@ -1,4 +1,4 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_accel.c-arc 1.15 29 Nov 2000 12:12:04 Frido $ */ +/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_accel.c-arc 1.16 03 Jan 2001 13:29:06 Frido $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.4 2001/02/15 18:20:33 dawes Exp $ */ #include "smi.h" @@ -404,7 +404,7 @@ SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, if (pScrn->bitsPerPixel == 24) { x1 *= 3; - x2 *= 2; + x2 *= 3; w *= 3; if (pSmi->Chipset == SMI_LYNX) @@ -714,10 +714,11 @@ SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, if (pScrn->bitsPerPixel <= 16) { - unsigned char * pattern = pSmi->FBBase + patx * pSmi->Bpp - + paty * pSmi->Stride; + /* PDR#950 */ + CARD8* pattern = pSmi->FBBase + + (patx + paty * pSmi->Stride) * pSmi->Bpp; - WaitQueue(1); + WaitIdleEmpty(); WRITE_DPR(pSmi, 0x0C, SMI_BITBLT | SMI_COLOR_PATTERN); memcpy(pSmi->DataPortBase, pattern, 8 * pSmi->Bpp * 8); } @@ -777,7 +778,7 @@ SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, WaitQueue(3); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (y & 0xFFFF)); + WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); /* PDR#950 */ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); LEAVE_PROC("SMI_SubsequentColor8x8PatternFillRect"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c index 719399f9f..68257cda5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c @@ -1,4 +1,4 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_driver.c-arc 1.40 06 Dec 2000 15:35:00 Frido $ */ +/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_driver.c-arc 1.42 03 Jan 2001 13:52:16 Frido $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.6 2000/12/14 01:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.9 2001/02/15 18:20:33 dawes Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -37,11 +37,9 @@ authorization from The XFree86 Project or Silicon Motion. #include "smi.h" -#ifdef DPMSExtension - #include "globals.h" - #define DPMS_SERVER - #include "extensions/dpms.h" -#endif +#include "globals.h" +#define DPMS_SERVER +#include "extensions/dpms.h" /* * Internals @@ -74,10 +72,8 @@ static Bool SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode); static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); -#ifdef DPMSExtension static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif static Bool SMI_ddc1(int scrnIndex); static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn); static void SMI_FreeScreen(int ScrnIndex, int flags); @@ -86,10 +82,10 @@ static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index); #define SILICONMOTION_NAME "Silicon Motion" #define SILICONMOTION_DRIVER_NAME "siliconmotion" -#define SILICONMOTION_VERSION_NAME "1.2.0" +#define SILICONMOTION_VERSION_NAME "1.2.2" #define SILICONMOTION_VERSION_MAJOR 1 #define SILICONMOTION_VERSION_MINOR 2 -#define SILICONMOTION_PATCHLEVEL 0 +#define SILICONMOTION_PATCHLEVEL 2 #define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \ | (SILICONMOTION_VERSION_MINOR << 16) \ | (SILICONMOTION_PATCHLEVEL) \ @@ -157,6 +153,7 @@ typedef enum OPTION_BYTESWAP, #endif OPTION_USEBIOS, + OPTION_ZOOMONLCD, NUMBER_OF_OPTIONS } SMIOpts; @@ -180,6 +177,7 @@ static OptionInfoRec SMIOptions[] = { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, #endif { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -741,6 +739,9 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) pSmi->shadowFB ? "enabled" : "disabled"); } + #if 1 /* PDR#932 */ + if ((pScrn->depth == 8) || (pScrn->depth == 16)) + #endif /* PDR#932 */ if ((s = xf86GetOptValString(SMIOptions, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) @@ -801,6 +802,17 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) pSmi->useBIOS = TRUE; } + if (xf86GetOptValBool(SMIOptions, OPTION_ZOOMONLCD, &pSmi->zoomOnLCD)) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ZoomOnLCD %s.\n", + pSmi->zoomOnLCD ? "enabled" : "disabled"); + } + else + { + /* Default to ZoomOnLCD disabled. */ + pSmi->zoomOnLCD = FALSE; + } + /* Find the PCI slot for this screen */ pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if ((pEnt->location.type != BUS_PCI) || (pEnt->resources)) @@ -1234,6 +1246,20 @@ SMI_EnterVT(int scrnIndex, int flags) { BoxRec box; + /* #920 */ + if (pSmi->paletteBuffer) + { + int i; + + VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, 0); + for(i = 0; i < 256 * 3; i++) + { + VGAOUT8(pSmi, VGA_DAC_DATA, pSmi->paletteBuffer[i]); + } + xfree(pSmi->paletteBuffer); + pSmi->paletteBuffer = NULL; + } + if (pSmi->pSaveBuffer) { memcpy(pSmi->FBBase, pSmi->pSaveBuffer, pSmi->saveBufferSize); @@ -1280,6 +1306,22 @@ SMI_LeaveVT(int scrnIndex, int flags) pSmi->savedFBOffset = pSmi->FBOffset; pSmi->savedFBReserved = pSmi->FBReserved; + + /* #920 */ + if (pSmi->Bpp == 1) + { + pSmi->paletteBuffer = xnfalloc(256 * 3); + if (pSmi->paletteBuffer) + { + int i; + + VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0); + for (i = 0; i < 256 * 3; i++) + { + pSmi->paletteBuffer[i] = VGAIN8(pSmi, VGA_DAC_DATA); + } + } + } } memset(pSmi->FBBase, 0, 256 * 1024); /* #689 */ @@ -1371,6 +1413,9 @@ SMI_Save(ScrnInfoPtr pScrn) { save->CRA0[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0xA0 + i); } + + /* PDR#1069 */ + VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, save->CR90[14]); } else { @@ -1580,6 +1625,8 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) } } + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, 0x00); + WRITE_DPR(pSmi, 0x10, restore->DPR10); WRITE_DPR(pSmi, 0x1C, restore->DPR1C); WRITE_DPR(pSmi, 0x20, restore->DPR20); @@ -1739,16 +1786,16 @@ SMI_MapMem(ScrnInfoPtr pScrn) * the frame buffer. Also set up the reserved memory space. */ pSmi->FBCursorOffset = pSmi->videoRAMBytes - 1024; - if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_INDEX, 0x30) & 0x01) + if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01)/* #1074 */ { - CARD32 fifiOffset = 0; - fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46) + CARD32 fifoOffset = 0; + fifoOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46) << 3; - fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47) + fifoOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47) << 11; - fifiOffset |= (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49) + fifoOffset |= (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49) & 0x1C) << 17; - pSmi->FBReserved = pSmi->videoRAMBytes - fifiOffset; + pSmi->FBReserved = fifoOffset; /* PDR#1074 */ } else { @@ -2018,12 +2065,10 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pSmi->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SMI_CloseScreen; -#ifdef DPMSExtension if (!xf86DPMSInit(pScreen, SMI_DisplayPowerManagementSet, 0)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); } -#endif SMI_InitVideo(pScreen); @@ -2158,7 +2203,7 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) mem = (pScrn->virtualX * pScrn->bitsPerPixel / 8 + 15) & ~15; mem *= pScrn->virtualY * 2; - if (mem > pSmi->videoRAMBytes - pSmi->FBReserved) + if (mem > pSmi->FBReserved) /* PDR#1074 */ { LEAVE_PROC("SMI_ValidMode"); return(MODE_MEM); @@ -2167,15 +2212,8 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) if (!pSmi->useBIOS || pSmi->lcd) { - if ( (mode->HDisplay != pSmi->lcdWidth) - || (mode->VDisplay != pSmi->lcdHeight) - ) - { - LEAVE_PROC("SMI_ValidMode"); - return(MODE_PANEL); - } - - if (pSmi->rotate) + #if 1 /* PDR#983 */ + if (pSmi->zoomOnLCD) { if ( (mode->HDisplay > pSmi->lcdWidth) || (mode->VDisplay > pSmi->lcdHeight) @@ -2185,8 +2223,33 @@ SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) return(MODE_PANEL); } } + else + #endif + { + if ( (mode->HDisplay != pSmi->lcdWidth) + || (mode->VDisplay != pSmi->lcdHeight) + ) + { + LEAVE_PROC("SMI_ValidMode"); + return(MODE_PANEL); + } + } + } + #if 1 /* PDR#944 */ + if (pSmi->rotate) + { + if ( (mode->HDisplay != pSmi->lcdWidth) + || (mode->VDisplay != pSmi->lcdHeight) + ) + { + LEAVE_PROC("SMI_ValidMode"); + return(MODE_PANEL); + } + } + #endif + LEAVE_PROC("SMI_ValidMode"); return(MODE_OK); } @@ -2589,6 +2652,11 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) { xfree(pSmi->pSaveBuffer); } + /* #920 */ + if (pSmi->paletteBuffer) + { + xfree(pSmi->paletteBuffer); + } pScrn->vtSema = FALSE; pScreen->CloseScreen = pSmi->CloseScreen; @@ -2635,10 +2703,22 @@ SMI_AdjustFrame(int scrnIndex, int x, int y, int flags) if (SMI_LYNX3D_SERIES(pSmi->Chipset)) { Base = (Base + 15) & ~15; + #if 1 /* PDR#1058 */ + while ((Base % pSmi->Bpp) > 0) + { + Base -= 16; + } + #endif } else { Base = (Base + 7) & ~7; + #if 1 /* PDR#1058 */ + while ((Base % pSmi->Bpp) > 0) + { + Base -= 8; + } + #endif } WRITE_VPR(pSmi, 0x0C, Base >> 3); @@ -2825,7 +2905,6 @@ SMI_PrintRegs(ScrnInfoPtr pScrn) * SMI_DisplayPowerManagementSet -- Sets VESA Display Power Management * Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2980,7 +3059,6 @@ SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, LEAVE_PROC("SMI_DisplayPowerManagementSet"); } -#endif static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c index d7b288ea2..9022ba330 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.3 2001/02/15 18:20:33 dawes Exp $ */ #include "smi.h" #include "smi_video.h" @@ -122,7 +122,6 @@ void SMI_InitVideo(ScreenPtr pScreen) if ( (psmi->rotate == 0) && !psmi->NoAccel - && (pScrn->bitsPerPixel != 8) ) { newAdaptor = SMI_SetupVideo(pScreen); @@ -189,7 +188,6 @@ static XF86VideoEncodingRec SMI_VideoEncodings[] = static XF86VideoFormatRec SMI_VideoFormats[] = { - { 8, PseudoColor }, /* depth, class */ { 15, TrueColor }, /* depth, class */ { 16, TrueColor }, /* depth, class */ { 24, TrueColor }, /* depth, class */ @@ -213,6 +211,7 @@ static XF86ImageRec SMI_VideoImages[] = { XVIMAGE_YUY2, XVIMAGE_YV12, + XVIMAGE_I420, { FOURCC_RV15, /* id */ XvRGB, /* type */ @@ -912,6 +911,14 @@ SMI_PutImage( dstPitch = ((width << 1) + 15) & ~15; break; + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offset3 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset2 = offset3 + (srcPitch2 * (height >> 1)); + dstPitch = ((width << 1) + 15) & ~15; + break; + case FOURCC_RV24: bpp = 3; srcPitch = width * bpp; @@ -953,6 +960,7 @@ SMI_PutImage( switch (id) { case FOURCC_YV12: + case FOURCC_I420: top &= ~1; tmp = ((top >> 1) * srcPitch2) + (left >> 2); offset2 += tmp; @@ -1020,6 +1028,7 @@ SMI_QueryImageAttributes( switch (id) { case FOURCC_YV12: + case FOURCC_I420: *height = (*height + 1) & ~1; size = (*width + 3) & ~3; if (pitches != NULL) @@ -1164,6 +1173,10 @@ SMI_ClipVideo( ENTER_PROC("SMI_ClipVideo"); + /* PDR#941 */ + extents->x1 = max(extents->x1, pScrn->frameX0); + extents->y1 = max(extents->y1, pScrn->frameY0); + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); @@ -1278,6 +1291,7 @@ SMI_DisplayVideo( switch (id) { case FOURCC_YV12: + case FOURCC_I420: case FOURCC_YUY2: vpr00 |= 0x6; break; @@ -1614,6 +1628,7 @@ SMI_AllocSurface( switch (id) { case FOURCC_YV12: + case FOURCC_I420: case FOURCC_YUY2: case FOURCC_RV15: case FOURCC_RV16: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c index 5cde319e6..fcc011b61 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.3 2000/12/02 01:16:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.4 2001/02/14 19:08:32 dawes Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -1355,7 +1355,7 @@ VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn USHORT oldREFIndex,CRT1ModeNo,oldModeIDOffset; long int longtemp; - USHORT LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */ + static USHORT LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */ 00, 79, 77, 71, 69, 49, /* 64 bit BQ=1 */ 88, 80, 78, 72, 70, 00, /* 128 bit BQ=2 */ 00, 72, 70, 64, 62, 44, /* 128 bit BQ=1 */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp deleted file mode 100644 index 08f3b7404..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp,v 1.5 2000/12/11 20:18:26 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SIS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sis \- SiS video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsis\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B sis -is an XFree86 driver for SiS video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B sis -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c index 9dc2feb48..da8a6b182 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.8 2000/12/02 01:16:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.9 2000/12/21 12:22:57 alanh Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp b/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp deleted file mode 100644 index 8be9c868a..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp,v 1.2 2000/12/11 20:18:27 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNBW2 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sunbw2 \- BW2 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunbw2\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B sunbw2 -is an XFree86 driver for Sun BW2 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B sunbw2 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp deleted file mode 100644 index 1d111923a..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp,v 1.2 2000/12/11 20:18:29 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG14 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg14 \- CG14 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg14\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg14 -is an XFree86 driver for Sun CG14 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg14 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp b/xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp deleted file mode 100644 index eb183fbe2..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp,v 1.2 2000/12/11 20:18:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG3 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg3 \- CG3 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg3\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg3 -is an XFree86 driver for Sun CG3 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg3 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp b/xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp deleted file mode 100644 index 8ff863c39..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp,v 1.3 2000/12/11 20:18:32 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG6 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg6 \- GX/Turbo GX video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg6\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg6 -is an XFree86 driver for Sun GX and Turbo GX (also known as cgsix) video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg6 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c index af7d6a1cb..0b31ce5da 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.4 2000/06/23 23:43:44 alanh Exp $ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.5 2000/12/21 12:22:57 alanh Exp $ * Acceleration for the Creator and Creator3D framebuffer - DRI/DRM support. * * Copyright (C) 2000 David S. Miller (davem@redhat.com) @@ -214,6 +214,19 @@ FFBDRIScreenInit(ScreenPtr pScreen) "FFBDRIScreenInit failed (libdri.a too old)\n"); return FALSE; } + + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 1 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, " + "expected 3.1.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } pDRIInfo = DRICreateInfoRec(); if (pDRIInfo == NULL) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp deleted file mode 100644 index 1ee144b56..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp,v 1.3 2000/12/11 20:18:33 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH FFB __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -ffb \- SUNFFB video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunffb\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B ffb -is an XFree86 driver for Sun Creator, Creator 3D and Elite 3D video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B ffb -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com>, David S. Miller <davem@redhat.com>, Michal Rehacek <majkl@iname.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp deleted file mode 100644 index ee22b004d..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp,v 1.4 2000/12/11 20:18:34 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNLEO __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sunleo \- Leo video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunleo\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B leo -is an XFree86 driver for Sun Leo (ZX) video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B leo -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp b/xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp deleted file mode 100644 index 311f8aaf0..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp,v 1.2 2000/12/11 20:18:35 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNTCX __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suntcx \- TCX video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuntcx\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suntcx -is an XFree86 driver for Sun TCX video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suntcx -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile index dc98911b9..24087804c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.19 2000/12/15 15:19:35 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.20 2001/01/24 00:06:31 dawes Exp $ XCOMM XCOMM This is the Imakefile for the TDFX driver. XCOMM @@ -50,7 +50,6 @@ ObjectModuleTarget(tdfx,$(OBJS)) InstallObjectModule(tdfx,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(tdfx,) InstallModuleManPage(tdfx) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index beee925a7..e9a9f4500 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -5,7 +5,7 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.17 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.18 2000/12/20 01:30:46 mvojkovi Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man index 483a12622..1dd66a7d1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man @@ -1,7 +1,7 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp,v 1.6 2000/12/11 20:18:36 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man,v 1.2 2001/01/27 18:20:55 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' -.TH TDFX __drivermansuffix__ "Version 4.0.2" "XFree86" +.TH TDFX __drivermansuffix__ __vendorversion__ .SH NAME tdfx \- 3Dfx video driver .SH SYNOPSIS diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c index d97363b57..f52859e39 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.3 2000/06/17 00:03:25 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.5 2001/01/13 00:06:29 mvojkovi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -32,13 +32,7 @@ DGAFunctionRec TDFX_DGAFuncs = { TDFX_BlitTransRect }; -/* -We should allow you to change the depth, but the accel driver isn't -ready to handle that yet. Also, we are currently taking the default -visual and using it for the visual reported by DGA. It would be -relatively easy to at least give DirectColor and TrueColor visuals -instead of just the default -*/ + Bool TDFXDGAInit(ScreenPtr pScreen) { @@ -47,22 +41,19 @@ TDFXDGAInit(ScreenPtr pScreen) DisplayModePtr pMode, firstMode; DGAModePtr modes=0, newmodes=0, currentMode; int num=0; - Bool oneMore; pTDFX = TDFXPTR(pScrn); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num+1)*sizeof(DGAModeRec)); - oneMore = FALSE; + if (!newmodes) { xfree(modes); return FALSE; } modes = newmodes; -SECOND_PASS: - currentMode = modes+num; num++; currentMode->mode = pMode; @@ -82,33 +73,21 @@ SECOND_PASS: currentMode->visualClass = pScrn->defaultVisual; currentMode->viewportWidth = pMode->HDisplay; currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (3 - pTDFX->cpp); + currentMode->xViewportStep = 1; currentMode->yViewportStep = 1; currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = pTDFX->fbOffset; + currentMode->offset = 0; currentMode->address = pTDFX->FbBase; - - if (oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = ((pScrn->displayWidth * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; - } + currentMode->bytesPerScanline = ((pScrn->displayWidth*pTDFX->cpp)+3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pTDFX->pixmapCacheLinesMax; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; pMode = pMode->next; if (pMode == firstMode) break; @@ -129,19 +108,17 @@ TDFX_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) if (!pMode) { /* restore the original mode */ /* put the ScreenParameters back */ - if (pTDFX->DGAactive) { - TDFXSwitchMode(index, OldModes[index], 0); - TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); - pTDFX->DGAactive = FALSE; + if(pTDFX->DGAactive) { + TDFXSwitchMode(index, OldModes[index], 0); + TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); + pTDFX->DGAactive = FALSE; } } else { - /* save the old ScreenParameters */ - if (!pTDFX->DGAactive) { - OldModes[index] = pScrn->currentMode; - pTDFX->DGAactive = TRUE; + if (!pTDFX->DGAactive) { /* save the old parameters */ + OldModes[index] = pScrn->currentMode; + pTDFX->DGAactive = TRUE; } - pScrn->displayWidth = pMode->bytesPerScanline / pTDFX->cpp; TDFXSwitchMode(index, pMode->mode, 0); } @@ -164,10 +141,11 @@ TDFX_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) TDFXAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - while (hwp->readST01(hwp) & 0x08); - while (!(hwp->readST01(hwp) & 0x08)); + /* fixme */ + while(hwp->readST01(hwp) & 0x08); + while(!(hwp->readST01(hwp) & 0x08)); - pTDFX->DGAViewportStatus = 0; + pTDFX->DGAViewportStatus = 0; } static void @@ -223,9 +201,9 @@ TDFX_OpenFramebuffer( TDFXPtr pTDFX = TDFXPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pTDFX->LinearAddr[0]; + *mem = (unsigned char*)pTDFX->LinearAddr[0] + pTDFX->fbOffset; *size = pTDFX->FbMapSize; - *offset = 0; + *offset = /* pTDFX->fbOffset */ 0 ; /* DGA is broken */ *flags = DGA_NEED_ROOT; return TRUE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index 5d160998d..a5b9b38de 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.14 2000/12/07 20:26:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.17 2000/12/21 12:22:57 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -530,12 +530,6 @@ TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) pTDFX->AccelInfoRec->NeedToSync = TRUE; } -/* - This routine is a modified form of XAADoBitBlt with the calls to - ScreenToScreenBitBlt built in. My routine has the prgnSrc as source - instead of destination. My origin is upside down so the ydir cases - are reversed. -*/ static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) @@ -543,141 +537,37 @@ TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TDFXPtr pTDFX = TDFXPTR(pScrn); - int nbox; - BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - DDXPointPtr pptTmp, pptNew1, pptNew2; - int xdir, ydir; - int dx, dy, x, y, w, h; - DDXPointPtr pptSrc; - - pbox = REGION_RECTS(prgnSrc); - nbox = REGION_NUM_RECTS(prgnSrc); - pboxNew1 = 0; - pptNew1 = 0; - pboxNew2 = 0; - pboxNew2 = 0; - pptSrc = &ptOldOrg; + int dx, dy, xdir, ydir, i, x, y, nbox; + BoxPtr pbox; dx = pParent->drawable.x - ptOldOrg.x; dy = pParent->drawable.y - ptOldOrg.y; - /* If the copy will overlap in Y, reverse the order */ - if (dy>0) { - ydir = -1; - - if (nbox>1) { - /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - if (!pboxNew1) return; - pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); - if (!pptNew1) { - DEALLOCATE_LOCAL(pboxNew1); - return; - } - pboxBase = pboxNext = pbox+nbox-1; - while (pboxBase >= pbox) { - while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext+1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } else { - /* No changes required */ - ydir = 1; - } + DRIMoveBuffersHelper(pScreen, dx, dy, &xdir, &ydir, prgnSrc); - /* If the regions will overlap in X, reverse the order */ - if (dx>0) { - xdir = -1; - - if (nbox > 1) { - /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); - if (!pboxNew2 || !pptNew2) { - if (pptNew2) DEALLOCATE_LOCAL(pptNew2); - if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); - if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } else { - /* No changes are needed */ - xdir = 1; - } + pbox = REGION_RECTS(prgnSrc); + nbox = REGION_NUM_RECTS(prgnSrc); - TDFXSetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); - while (nbox--) { - w=pbox->x2-pbox->x1+1; - h=pbox->y2-pbox->y1+1; - - /* Unlike XAA, we don't get handed clipped values */ - if (pbox->x1+dx<0) { - x=-dx; - w-=x-pbox->x1; - } else { - if (pbox->x1+dx+w>pScrn->virtualX) { - x=pScrn->virtualX-dx-w-1; - w-=pbox->x1-x; - } else x=pbox->x1; - } - if (pbox->y1+dy<0) { - y=-dy; - h-=y-pbox->y1; - } else { - if (pbox->y1+dy+h>pScrn->virtualY) { - y=pScrn->virtualY-dy-h-1; - h-=pbox->y1-y; - } else y=pbox->y1; - } - if (w<0 || h<0 || x>pScrn->virtualX || y>pScrn->virtualY) continue; + TDFXSetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, ~0, -1); - TDFXSelectBuffer(pTDFX, TDFX_BACK); - TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, w, h); - TDFXSelectBuffer(pTDFX, TDFX_DEPTH); - TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, w, h); - pbox++; + TDFXSelectBuffer(pTDFX, TDFX_BACK); + for(i = 0; i < nbox; i++) { + x = pbox[i].x1; + y = pbox[i].y1; + TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, + pbox[i].x2 - x, pbox[i].y2 - y); } - TDFXSelectBuffer(pTDFX, TDFX_FRONT); - if (pboxNew2) { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); - } - if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + TDFXSelectBuffer(pTDFX, TDFX_DEPTH); + for(i = 0; i < nbox; i++) { + x = pbox[i].x1; + y = pbox[i].y1; + TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, + pbox[i].x2 - x, pbox[i].y2 - y); } + TDFXSelectBuffer(pTDFX, TDFX_FRONT); + pTDFX->AccelInfoRec->NeedToSync = TRUE; } @@ -711,14 +601,13 @@ TDFXDRICloseFullScreen(ScreenPtr pScreen) return TRUE; } - static void TDFXDRITransitionTo2d(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TDFXPtr pTDFX = TDFXPTR(pScrn); - xf86FreeOffscreenArea(pTDFX->reservedArea); + xf86FreeOffscreenArea(pTDFX->reservedArea); } @@ -729,19 +618,11 @@ TDFXDRITransitionTo3d(ScreenPtr pScreen) TDFXPtr pTDFX = TDFXPTR(pScrn); FBAreaPtr pArea; - if(pTDFX->overlayBuffer) { - xf86FreeOffscreenLinear(pTDFX->overlayBuffer); - pTDFX->overlayBuffer = NULL; - } - - if(pTDFX->textureBuffer) { - xf86FreeOffscreenArea(pTDFX->textureBuffer); - pTDFX->textureBuffer = NULL; - } + if(pTDFX->videoScratch) + xf86FreeOffscreenLinear(pTDFX->videoScratch); xf86PurgeUnlockedOffscreenAreas(pScreen); - - /* this is an ugly hack! isnt there a resize? */ + pArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, pTDFX->pixmapCacheLinesMin, pScrn->displayWidth, NULL, NULL, NULL); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index e3c72918d..bf0b131b5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.47 2000/12/02 15:30:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.64 2001/02/15 18:01:43 eich Exp $ */ /* * Authors: @@ -78,11 +78,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* !!! These need to be checked !!! */ #if 0 -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" #endif -#endif /* The driver's own header file: */ @@ -98,10 +96,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dri.h" #endif -#ifdef RENDER -#include "picturestr.h" -#endif - /* Required Functions: */ static OptionInfoPtr TDFXAvailableOptions(int chipid, int busid); @@ -138,11 +132,9 @@ static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool static void TDFXBlockHandler(int, pointer, pointer, pointer); -#ifdef DPMSExtension /* Switch to various Display Power Management System levels */ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#endif #define PCI_SUBDEVICE_ID_VOODOO3_2000 0x0036 #define PCI_SUBDEVICE_ID_VOODOO3_3000 0x003a @@ -150,9 +142,6 @@ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, DriverRec TDFX = { TDFX_VERSION, TDFX_DRIVER_NAME, -#if 0 - "Accelerated driver for 3dfx cards", -#endif TDFXIdentify, TDFXProbe, TDFXAvailableOptions, @@ -233,9 +222,7 @@ static const char *ddcSymbols[] = { #ifdef XFree86LOADER static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -717,11 +704,30 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) TDFXFreeRec(pScrn); return FALSE; } + /* + * We don't need VGA resources during OPERATING state. However I'm + * not sure if they are disabled. + */ + xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResUnusedOpr); +#if 1 + + /* Is VGA memory disabled during OPERATING state? */ + xf86SetOperatingState(resVgaMemShared, pTDFX->pEnt->index, ResDisableOpr); +#else + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; +#endif + +#if 0 + /* + * I'm sure we don't need to set these. All resources + * for these operations are exclusive. + */ if (pTDFX->usePIO) pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; else pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; +#endif /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -948,10 +954,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) TDFXFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); if (!xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { @@ -984,6 +987,13 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key default 0x%x\n", pTDFX->videoKey = 0x1E); } + if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + pTDFX->videoKey); + } else + pTDFX->videoKey = 0x1E; + + if (!xf86ReturnOptValBool(TDFXOptions, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { TDFXFreeRec(pScrn); @@ -1671,8 +1681,10 @@ calcBufferSize(int xres, int yres, Bool tiled, int cpp) } /* calcBufferSize */ static void allocateMemory(ScrnInfoPtr pScrn) { - TDFXPtr pTDFX = TDFXPTR(pScrn); - int memRemaining, fbSize, cursorSize, fifoSize, screenSizeInTiles; + TDFXPtr pTDFX; + int memRemaining, fifoSize, screenSizeInTiles; + + pTDFX = TDFXPTR(pScrn); if (pTDFX->cpp!=3) { screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY, @@ -1713,29 +1725,26 @@ static void allocateMemory(ScrnInfoPtr pScrn) { } /* Give the cmd fifo at least */ /* CMDFIFO_PAGES pages, but no more than */ - /* 255. */ + /* 255. We give 4096 bytes to the cursor */ fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; - fbSize = (pScrn->virtualY + pTDFX->pixmapCacheLinesMin) * pTDFX->stride; - cursorSize = 4096; - /* We give 4096 bytes to the cursor, fifoSize to the */ - /* FIFO, and everything to textures. */ - /* Bump everything by 64k to move it past VGA memory */ - pTDFX->cursorOffset = 64*1024; - pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize; + pTDFX->cursorOffset = 0; + pTDFX->fifoOffset = 4096; pTDFX->fifoSize = fifoSize; /* Now, place the front buffer, forcing */ /* it to be on a page boundary too, just */ /* for giggles. */ - pTDFX->fbOffset = (pTDFX->fifoOffset + pTDFX->fifoSize) &~ 0xFFF; - pTDFX->texOffset = pTDFX->fbOffset + fbSize; + pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize; + pTDFX->texOffset = pTDFX->fbOffset + + ((pScrn->virtualY+pTDFX->pixmapCacheLinesMin)*pTDFX->stride); pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset; - - if (pTDFX->texSize <= 0) { + pTDFX->cursorOffset = 0; + if (pTDFX->texSize < 0) { pTDFX->backOffset = -1; pTDFX->depthOffset = -1; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available, disabling DRI\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Texture Memory %0.02f MB\n", pTDFX->texSize / 1024.0 / 1024.0); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n", + (float)pTDFX->texSize/1024.0/1024.0); } #if 1 @@ -1756,6 +1765,11 @@ static void allocateMemory(ScrnInfoPtr pScrn) { pTDFX->texOffset, pTDFX->texOffset + pTDFX->texSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Front Buffer Offset: [0x%08X, 0x%08X)\n", + pTDFX->fbOffset, + pTDFX->fbOffset + + (pScrn->virtualY+pTDFX->pixmapCacheLinesMin)*pTDFX->stride); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BackOffset: [0x%08X, 0x%08X)\n", pTDFX->backOffset, pTDFX->backOffset + screenSizeInTiles); @@ -1772,7 +1786,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { vgaHWPtr hwp; TDFXPtr pTDFX; VisualPtr visual; - int maxy; BoxRec MemBox; TDFXTRACE("TDFXScreenInit start\n"); @@ -1787,9 +1800,10 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { vgaHWGetIOBase(hwp); if (!vgaHWMapMem(pScrn)) return FALSE; - /* we want at least enough pixmap cache to do DVD */ pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; - pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1) / pTDFX->stride; + + /* enough to do DVD */ + pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1)/pTDFX->stride; allocateMemory(pScrn); @@ -1812,30 +1826,29 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; } - pTDFX->pixmapCacheLinesMax = (pTDFX->backOffset - pTDFX->fbOffset) / pTDFX->stride; + pTDFX->pixmapCacheLinesMax = (pTDFX->backOffset - pTDFX->fbOffset) / + pTDFX->stride; + if(pTDFX->ChipType < PCI_CHIP_VOODOO5) { - if (pTDFX->pixmapCacheLinesMax > 2048) - pTDFX->pixmapCacheLinesMax = 2048; + if(pTDFX->pixmapCacheLinesMax > 2048) + pTDFX->pixmapCacheLinesMax = 2048; } else { - if (pTDFX->pixmapCacheLinesMax > 4095) - pTDFX->pixmapCacheLinesMax = 4095; + /* MaxClip seems to have only 12 bits => 0->4095 */ + if(pTDFX->pixmapCacheLinesMax > 4095) + pTDFX->pixmapCacheLinesMax = 4095; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%d pixmap cache lines for 2D/video when 3D inactive\n", - pTDFX->pixmapCacheLinesMax); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%d pixmap cache lines for 2D/video when 3D active\n", - pTDFX->pixmapCacheLinesMin); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%i lines of offscreen memory available for 2D and video\n", + pTDFX->pixmapCacheLinesMax); - /* region the whole memory (framebuffer+pixmapcache) and let - * xf86InitFBManager do the visible region subtraction - */ - MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x1 = 0; MemBox.x2 = pScrn->displayWidth; MemBox.y2 = pTDFX->pixmapCacheLinesMax; - pTDFX->maxClip = (MemBox.x2) | (MemBox.y2 << 16); + + pTDFX->maxClip = MemBox.x2 | (MemBox.y2 << 16); TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1874,9 +1887,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1939,9 +1950,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXAdjustFrame(scrnIndex, 0, 0, 0); -#ifdef DPMSExtension xf86DPMSInit(pScreen, TDFXDisplayPowerManagementSet, 0); -#endif #ifdef XF86DRI if (!pTDFX->NoAccel) { @@ -2001,6 +2010,8 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { y += pScrn->virtualY - 1; tdfxReg = &pTDFX->ModeReg; + if(pTDFX->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; tdfxReg->startaddr = pTDFX->fbOffset+y*pTDFX->stride+(x*pTDFX->cpp); TDFXTRACE("TDFXAdjustFrame to x=%d y=%d offset=%d\n", x, y, tdfxReg->startaddr); pTDFX->writeLong(pTDFX, VIDDESKTOPSTARTADDR, tdfxReg->startaddr); @@ -2106,7 +2117,13 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) xf86XVFreeVideoAdaptorRec(pTDFX->textureAdaptor); pTDFX->textureAdaptor = NULL; } - + + if (pTDFX->adaptor) { + xfree(pTDFX->adaptor->pPortPrivates[0].ptr); + xf86XVFreeVideoAdaptorRec(pTDFX->adaptor); + pTDFX->adaptor = NULL; + } + pScrn->vtSema=FALSE; pScreen->BlockHandler = pTDFX->BlockHandler; @@ -2195,7 +2212,6 @@ TDFXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) } } -#ifdef DPMSExtension static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -2227,5 +2243,3 @@ TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, dacmode|=state; pTDFX->writeLong(pTDFX, DACMODE, dacmode); } -#endif - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c index d63592085..0c9554d5b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c @@ -1,9 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.2 2000/12/02 15:30:57 tsi Exp $ */ - -#ifndef XvExtension -void TDFXInitVideo(ScreenPtr pScreen) {} -void TDFXCloseVideo(ScreenPtr pScreen) {} -#else +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.9 2001/01/25 02:20:34 mvojkovi Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -12,79 +7,101 @@ void TDFXCloseVideo(ScreenPtr pScreen) {} #include "Xv.h" #include "fourcc.h" -static Atom xvColorKey, xvFilterQuality; +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 -/* These should move into tdfxdefs.h with better names */ -#define YUV_Y_BASE 0xC00000 -#define YUV_U_BASE 0xD00000 -#define YUV_V_BASE 0xE00000 +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 -#define SST_2D_FORMAT_YUYV 0x8 -#define SST_2D_FORMAT_UYVY 0x9 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) -#define YUVBASEADDR 0x80100 -#define YUVSTRIDE 0x80104 -#define VIDPROCCFGMASK 0xa2e3eb6c +#define VIDPROCCFGMASK 0xa2e3eb6c #define OFF_DELAY 250 /* milliseconds */ #define FREE_DELAY 15000 -#define OFF_TIMER 0x01 -#define FREE_TIMER 0x02 -#define CLIENT_VIDEO_ON 0x04 -#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +static XF86VideoAdaptorPtr TDFXSetupImageVideo(ScreenPtr); +static int TDFXSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void TDFXStopVideo(ScrnInfoPtr, pointer, Bool); +static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, + unsigned int *, unsigned int *, pointer); +static int TDFXPutImage(ScrnInfoPtr, short, short, short, short, short, + short, short, short, int, unsigned char*, short, + short, Bool, RegionPtr, pointer); +static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); -#define TDFX_MAX_OVERLAY_PORTS 1 -#define TDFX_MAX_TEXTURE_PORTS 32 -/* Doesn't matter what screen we use */ -#define DummyScreen screenInfo.screens[0] +static void TDFXResetVideo(ScrnInfoPtr); + +static void TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time); + -/* Needed for attribute atoms */ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -/* - * PROTOTYPES - */ +static Atom xvColorKey, xvFilterQuality; -void TDFXInitVideo(ScreenPtr pScreen); -void TDFXCloseVideo(ScreenPtr pScreen); -static FBAreaPtr TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height); -static FBLinearPtr TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size); -static void TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time); +typedef struct { + RegionRec clip; + CARD32 colorKey; + int filterQuality; + CARD32 videoStatus; + Time offTime; + Time freeTime; +} TDFXPortPrivRec, *TDFXPortPrivPtr; + +void TDFXInitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; -static XF86VideoAdaptorPtr TDFXSetupImageVideoTexture(ScreenPtr); -static int TDFXSetPortAttributeTexture(ScrnInfoPtr, Atom, INT32, pointer); -static int TDFXGetPortAttributeTexture(ScrnInfoPtr, Atom ,INT32 *, pointer); -static int TDFXPutImageTexture(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); -static void TDFXStopVideoTexture(ScrnInfoPtr, pointer, Bool); + if(pTDFX->AccelInfoRec && pTDFX->AccelInfoRec->FillSolidRects) + newAdaptor = TDFXSetupImageVideo(pScreen); -static XF86VideoAdaptorPtr TDFXSetupImageVideoOverlay(ScreenPtr); -static int TDFXSetPortAttributeOverlay(ScrnInfoPtr, Atom, INT32, pointer); -static int TDFXGetPortAttributeOverlay(ScrnInfoPtr, Atom ,INT32 *, pointer); -static int TDFXPutImageOverlay(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); -static void TDFXStopVideoOverlay(ScrnInfoPtr, pointer, Bool); -static void TDFXResetVideoOverlay(ScrnInfoPtr); + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); -static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); -static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } -/* - * ADAPTOR INFORMATION - */ + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); -static XF86VideoEncodingRec OverlayEncoding[] = -{ - { 0, "XV_IMAGE", 2048, 2048, {1, 1} } -}; + if(newAdaptors) + xfree(newAdaptors); +} -static XF86VideoEncodingRec TextureEncoding[] = +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding = { - { 0, "XV_IMAGE", 1024, 1024, {1, 1} } + 0, + "XV_IMAGE", + 2048, 2048, + {1, 1} }; -static XF86VideoFormatRec OverlayFormats[] = +#define NUM_FORMATS 12 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { {8, TrueColor}, {8, DirectColor}, {8, PseudoColor}, {8, GrayScale}, {8, StaticGray}, {8, StaticColor}, @@ -92,93 +109,37 @@ static XF86VideoFormatRec OverlayFormats[] = {15, DirectColor}, {16, DirectColor}, {24, DirectColor} }; -static XF86VideoFormatRec TextureFormats[] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; -static XF86AttributeRec OverlayAttributes[] = -{ - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} -}; +#define NUM_ATTRIBUTES 2 -static XF86AttributeRec TextureAttributes[] = +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} }; -static XF86ImageRec OverlayImages[] = -{ - XVIMAGE_YUY2, XVIMAGE_UYVY, XVIMAGE_YV12, XVIMAGE_I420 -}; +#define NUM_IMAGES 4 -static XF86ImageRec TextureImages[] = +static XF86ImageRec Images[NUM_IMAGES] = { - XVIMAGE_YV12, XVIMAGE_I420 + XVIMAGE_YUY2, + XVIMAGE_UYVY, + XVIMAGE_YV12, + XVIMAGE_I420 }; -/* - * COMMON SETUP FUNCTIONS - */ - -void TDFXInitVideo(ScreenPtr pScreen) +static void +TDFXResetVideo(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; - XF86VideoAdaptorPtr newOverlayAdaptor = NULL; - XF86VideoAdaptorPtr newTextureAdaptor = NULL; TDFXPtr pTDFX = TDFXPTR(pScrn); - int num_adaptors; - - /* The hardware can't convert YUV->8 bit color */ - if(pTDFX->cpp == 1) - return; - - /* Start with the generic adaptors */ - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - - /* Overlay adaptor */ - if(pTDFX->AccelInfoRec && pTDFX->AccelInfoRec->FillSolidRects) - newOverlayAdaptor = TDFXSetupImageVideoOverlay(pScreen); - - /* Texture adaptor */ - if(pTDFX->AccelInfoRec && pTDFX->AccelInfoRec->FillSolidRects) - newTextureAdaptor = TDFXSetupImageVideoTexture(pScreen); - - /* Add the overlay adaptor to the list */ - if(newOverlayAdaptor) { - newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newOverlayAdaptor; - adaptors = newAdaptors; /* FIXME: leak? */ - num_adaptors++; - } - } - - /* Add the texture adaptor to the list */ - if(newTextureAdaptor) { - newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newTextureAdaptor; - adaptors = newAdaptors; /* FIXME: leak? */ - num_adaptors++; - } - } - - if(num_adaptors) - xf86XVScreenInit(pScreen, adaptors, num_adaptors); - - if(newAdaptors) - xfree(newAdaptors); -} - + TDFXPortPrivPtr pPriv = pTDFX->adaptor->pPortPrivates[0].ptr; -void TDFXCloseVideo (ScreenPtr pScreen) -{ + /* reset the video */ + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pTDFX->writeLong(pTDFX, RGBMAXDELTA, 0x0080808); + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); } @@ -188,23 +149,21 @@ TDFXAllocAdaptor(ScrnInfoPtr pScrn, int numberPorts) XF86VideoAdaptorPtr adapt; TDFXPtr pTDFX = TDFXPTR(pScrn); TDFXPortPrivPtr pPriv; - int i; if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) - return NULL; + return NULL; - if(!(pPriv = xcalloc(1, sizeof(TDFXPortPrivRec) + numberPorts * sizeof(DevUnion)))) + if(!(pPriv = xcalloc(1, sizeof(TDFXPortPrivRec) + sizeof(DevUnion)))) { - xfree(adapt); - return NULL; + xfree(adapt); + return NULL; } adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); - for(i = 0; i < numberPorts; i++) - adapt->pPortPrivates[i].val = i; + adapt->pPortPrivates[0].ptr = (pointer)pPriv; - xvColorKey = MAKE_ATOM("XV_COLORKEY"); /* FIXME: twice, leak */ - xvFilterQuality = MAKE_ATOM("XV_FILTER_QUALITY"); /* FIXME: twice, leak */ + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvFilterQuality = MAKE_ATOM("XV_FILTER_QUALITY"); pPriv->colorKey = pTDFX->videoKey; pPriv->videoStatus = 0; @@ -213,17 +172,16 @@ TDFXAllocAdaptor(ScrnInfoPtr pScrn, int numberPorts) return adapt; } - static XF86VideoAdaptorPtr -TDFXSetupImageVideoOverlay(ScreenPtr pScreen) +TDFXSetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TDFXPtr pTDFX = TDFXPTR(pScrn); TDFXPortPrivPtr pPriv; XF86VideoAdaptorPtr adapt; - if (!pTDFX->OverlayXvideo) - return NULL; + if(!(adapt = TDFXAllocAdaptor(pScrn))) + return NULL; if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_OVERLAY_PORTS))) return NULL; @@ -231,15 +189,15 @@ TDFXSetupImageVideoOverlay(ScreenPtr pScreen) adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; adapt->name = "3dfx Video Overlay"; - adapt->nPorts = TDFX_MAX_OVERLAY_PORTS; - adapt->nEncodings = sizeof(OverlayEncoding) / sizeof(XF86VideoEncodingRec); - adapt->pEncodings = OverlayEncoding; - adapt->nFormats = sizeof(OverlayFormats) / sizeof(XF86VideoFormatRec); - adapt->pFormats = OverlayFormats; - adapt->nAttributes = sizeof(OverlayAttributes) / sizeof(XF86AttributeRec); - adapt->pAttributes = OverlayAttributes; - adapt->nImages = sizeof(OverlayImages) / sizeof(XF86ImageRec); - adapt->pImages = OverlayImages; + adapt->nEncodings = 1; + adapt->pEncodings = &DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->pImages = Images; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; @@ -248,111 +206,168 @@ TDFXSetupImageVideoOverlay(ScreenPtr pScreen) adapt->SetPortAttribute = TDFXSetPortAttributeOverlay; adapt->GetPortAttribute = TDFXGetPortAttributeOverlay; adapt->QueryBestSize = TDFXQueryBestSize; - adapt->PutImage = TDFXPutImageOverlay; + adapt->PutImage = TDFXPutImage; adapt->QueryImageAttributes = TDFXQueryImageAttributes; + pTDFX->adaptor = adapt; + pPriv = (TDFXPortPrivPtr)(adapt->pPortPrivates[0].ptr); REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0); - pTDFX->overlayAdaptor = adapt; - - TDFXResetVideoOverlay(pScrn); + TDFXResetVideo(pScrn); return adapt; } -static XF86VideoAdaptorPtr -TDFXSetupImageVideoTexture(ScreenPtr pScreen) +/* I really should stick this in miregion */ +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - TDFXPtr pTDFX = TDFXPTR(pScrn); - XF86VideoAdaptorPtr adapt; + int *dataA, *dataB; + int num; - if (!pTDFX->TextureXvideo) - return NULL; + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; - if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_TEXTURE_PORTS))) - return NULL; + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = 0; - adapt->name = "3dfx Video Texture"; - adapt->nPorts = TDFX_MAX_TEXTURE_PORTS; - adapt->nEncodings = sizeof(TextureEncoding) / sizeof(XF86VideoEncodingRec); - adapt->pEncodings = TextureEncoding; - adapt->nFormats = sizeof(TextureFormats) / sizeof(XF86VideoFormatRec); - adapt->pFormats = TextureFormats; - adapt->nAttributes = sizeof(TextureAttributes) / sizeof(XF86AttributeRec); - adapt->pAttributes = TextureAttributes; - adapt->nImages = sizeof(TextureImages) / sizeof(XF86ImageRec); - adapt->pImages = TextureImages; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = TDFXStopVideoTexture; - adapt->SetPortAttribute = TDFXSetPortAttributeTexture; - adapt->GetPortAttribute = TDFXGetPortAttributeTexture; - adapt->QueryBestSize = TDFXQueryBestSize; - adapt->PutImage = TDFXPutImageTexture; - adapt->QueryImageAttributes = TDFXQueryImageAttributes; + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); - pTDFX->textureAdaptor = adapt; + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } - return adapt; + return TRUE; } -/* - * MISCELLANEOUS ROUTINES - */ +/* TDFXClipVideo - + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (xa, ya + inclusive, xb, yb exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ -static int -TDFXQueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets +#define DummyScreen screenInfo.screens[0] + +static Bool +TDFXClipVideo( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height ){ - int size, tmp; + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; - if(*w > 1024) *w = 1024; - if(*h > 1024) *h = 1024; + hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); + vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); - *w = (*w + 1) & ~1; - if(offsets) offsets[0] = 0; + *xa <<= 16; *xb <<= 16; + *ya <<= 16; *yb <<= 16; - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if(pitches) pitches[0] = size; - size *= *h; - if(offsets) offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if(pitches) pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) pitches[0] = size; - size *= *h; - break; + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *xa += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *xb -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *ya += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *yb -= diff * vscale; } - return size; + if(*xa < 0) { + diff = (- *xa + hscale - 1)/ hscale; + dst->x1 += diff; + *xa += diff * hscale; + } + delta = *xb - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *xb -= diff * hscale; + } + if(*xa >= *xb) return FALSE; + + if(*ya < 0) { + diff = (- *ya + vscale - 1)/ vscale; + dst->y1 += diff; + *ya += diff * vscale; + } + delta = *yb - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *yb -= diff * vscale; + } + if(*ya >= *yb) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; } +static void +TDFXStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(cleanup) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + } + if(pTDFX->videoScratch) { + xf86FreeOffscreenLinear(pTDFX->videoScratch); + pTDFX->videoScratch = NULL; + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} static int -TDFXSetPortAttributeOverlay( +TDFXSetPortAttribute( ScrnInfoPtr pScrn, Atom attribute, INT32 value, @@ -363,21 +378,22 @@ TDFXSetPortAttributeOverlay( TDFXPtr pTDFX = TDFXPTR(pScrn); if(attribute == xvColorKey) { - pPriv->colorKey = value; - pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); - pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - } else if(attribute == xvFilterQuality) { - if((value < 0) || (value > 1)) + pPriv->colorKey = value; + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else + if(attribute == xvFilterQuality) { + if((value < 0) || (value > 1)) return BadValue; - pPriv->filterQuality = value; + pPriv->filterQuality = value; } else return BadMatch; return Success; } static int -TDFXGetPortAttributeOverlay( +TDFXGetPortAttribute( ScrnInfoPtr pScrn, Atom attribute, INT32 *value, @@ -386,37 +402,16 @@ TDFXGetPortAttributeOverlay( TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; if(attribute == xvColorKey) { - *value = pPriv->colorKey; - } else if(attribute == xvFilterQuality) { - *value = pPriv->filterQuality; + *value = pPriv->colorKey; + } else + if(attribute == xvFilterQuality) { + *value = pPriv->filterQuality; } else return BadMatch; return Success; } -static int -TDFXSetPortAttributeTexture( - ScrnInfoPtr pScrn, - Atom attribute, - INT32 value, - pointer data -) { - return Success; -} - - -static int -TDFXGetPortAttributeTexture( - ScrnInfoPtr pScrn, - Atom attribute, - INT32 *value, - pointer data -){ - return Success; -} - - static void TDFXQueryBestSize( ScrnInfoPtr pScrn, @@ -443,10 +438,11 @@ TDFXCopyData( int h, int w ){ + w <<= 1; while(h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; } } @@ -469,375 +465,76 @@ TDFXCopyMungedData( w >>= 1; for(j = 0; j < h; j++) { - dst = (CARD32*)dst1; - s1 = src1; s2 = src2; s3 = src3; - i = w; - while(i > 4) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); - dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); - dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); - dst += 4; s2 += 4; s3 += 4; s1 += 8; - i -= 4; - } - while(i--) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst++; s2++; s3++; - s1 += 2; - } - - dst1 += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } + dst = (CARD32*)dst1; + s1 = src1; s2 = src2; s3 = src3; + i = w; + while(i > 4) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); + dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); + dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); + dst += 4; s2 += 4; s3 += 4; s1 += 8; + i -= 4; + } + while(i--) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst++; s2++; s3++; + s1 += 2; + } + + dst1 += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } } } -/* - * TEXTURE DRAWING FUNCTIONS - */ - - -static void -TDFXStopVideoTexture(ScrnInfoPtr pScrn, pointer data, Bool cleanup) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; - - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - - if (cleanup) { - if(pTDFX->textureBuffer) { - xf86FreeOffscreenArea(pTDFX->textureBuffer); - pTDFX->textureBuffer = NULL; - } - } -} - - -static void -TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, - short src_x1, short src_y1, - short src_x2, short src_y2, - short dst_x1, short dst_y1, - short dst_x2, short dst_y2) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - /* reformulate the paramaters the way the hardware wants them */ - INT32 src_x = src_x1 & 0x1FFF; - INT32 src_y = src_y1 & 0x1FFF; - INT32 dst_x = dst_x1 & 0x1FFF; - INT32 dst_y = dst_y1 & 0x1FFF; - INT32 src_w = (src_x2 - src_x1) & 0x1FFF; - INT32 src_h = (src_y2 - src_y1) & 0x1FFF; - INT32 dst_w = (dst_x2 - dst_x1) & 0x1FFF; - INT32 dst_h = (dst_y2 - dst_y1) & 0x1FFF; - /* Setup for blit src and dest */ - TDFXMakeRoom(pTDFX, 4); - DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY|SSTCP_COMMAND/*|SSTCP_COMMANDEXTRA*/); - /* TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, SST_COMMANDEXTRA_VSYNC);*/ - TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); - TDFXWriteLong(pTDFX, SST_2D_COMMAND, SST_2D_SCRNTOSCRNSTRETCH | 0xCC000000); - /* Write to the launch area to start the blit */ - TDFXMakeRoom(pTDFX, 1); - DECLARE_LAUNCH(1, 0); - TDFXWriteLong(pTDFX, SST_2D_LAUNCH, (src_x<<1) | (src_y<<16)); - /* Wait for it to happen */ - TDFXSendNOPFifo2D(pScrn); -} - - -static void -YUVPlanarToPacked (ScrnInfoPtr pScrn, - short src_x, short src_y, - short src_h, short src_w, - int id, char *buf, - short width, short height, - FBAreaPtr fbarea) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - char *psrc, *pdst; - int count; - int baseaddr; - INT32 yuvBaseAddr, yuvStride; - - /* Save these registers so I can restore them when we are done. */ - yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); - yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); - - /* Set yuvBaseAddress and yuvStride. */ - baseaddr = pTDFX->fbOffset + pTDFX->cpp * fbarea->box.x1 + pTDFX->stride * fbarea->box.y1; - TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, pTDFX->stride); - TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, baseaddr); - - /* Copy Y plane (twice as much Y as U or V) */ - psrc = (char *)buf; - psrc += (src_x & ~0x1) + src_y * width; - pdst = (char *)pTDFX->MMIOBase[0] + YUV_Y_BASE; - TDFXCopyData(psrc, pdst, width, 1024, src_h, src_w + (src_x & 0x1)); - - /* Copy V plane */ - psrc = (char*)buf + width * height; - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - pdst = (char *)pTDFX->MMIOBase[0] + YUV_V_BASE; - TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); - - /* Copy U plane */ - psrc = (char*)buf + width * height + (width >> 1) * (height >> 1); - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - pdst = (char *)pTDFX->MMIOBase[0] + YUV_U_BASE; - TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); - - /* IDLE until the copy finished, timeout for safety */ - for (count = 0; count < 1000; count++) - if (!((TDFXReadLongMMIO(pTDFX, STATUS) & SST_BUSY))) - break; - - /* Restore trashed registers */ - TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); - TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); - - /* Wait for it to happen */ - TDFXSendNOPFifo2D(pScrn); -} - - -static int -TDFXPutImageTexture( - ScrnInfoPtr pScrn, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data - ) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - BoxPtr pbox; - int nbox; - int format; - - /* Check the source format */ - if (id == FOURCC_YV12) format = SST_2D_FORMAT_YUYV; - else if (id == FOURCC_UYVY) format = SST_2D_FORMAT_UYVY; - else return BadAlloc; - - /* Get a buffer to store the packed YUV data */ - if (!(pTDFX->textureBuffer = TDFXAllocateMemoryArea(pScrn, pTDFX->textureBuffer, src_w, src_h))) - return BadAlloc; - - /* Pack the YUV data in offscreen memory using YUV framebuffer (0x[CDE]0000) */ - YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, - id, (char *)buf, width, height, - pTDFX->textureBuffer); - - /* Setup source and destination pixel formats (yuv -> rgb) */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->stride|((pTDFX->cpp+1)<<16)); - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->stride|((format)<<16)); - - /* Blit packed YUV data from offscreen memory, respecting clips */ -#define SRC_X1 (pTDFX->textureBuffer->box.x1) -#define SRC_Y1 (pTDFX->textureBuffer->box.y1) -#define SCALEX(dx) ((int)(((dx) * src_w) / drw_w)) -#define SCALEY(dy) ((int)(((dy) * src_h) / drw_h)) - for (nbox = REGION_NUM_RECTS(clipBoxes), - pbox = REGION_RECTS(clipBoxes); nbox > 0; nbox--, pbox++) - { - TDFXScreenToScreenYUVStretchBlit (pScrn, - SRC_X1 + SCALEX(pbox->x1 - drw_x), - SRC_Y1 + SCALEY(pbox->y1 - drw_y), - SRC_X1 + SCALEX(pbox->x2 - drw_x), - SRC_Y1 + SCALEY(pbox->y2 - drw_y), - pbox->x1, pbox->y1, - pbox->x2, pbox->y2); - } - - /* Restore the WAX registers we trashed */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); - - /* Wait for it to happen */ - TDFXSendNOPFifo2D(pScrn); - - return Success; -} - - -/* - * COMMON DRAWING FUNCTIONS - */ - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - -static Bool -TDFXClipVideo( - BoxPtr dst, - INT32 *xa, - INT32 *xb, - INT32 *ya, - INT32 *yb, - RegionPtr reg, - INT32 width, - INT32 height +static FBLinearPtr +TDFXAllocateMemory( + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size ){ - INT32 vscale, hscale, delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); - vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); - - *xa <<= 16; *xb <<= 16; - *ya <<= 16; *yb <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *xa += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *xb -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *ya += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *yb -= diff * vscale; - } - - if(*xa < 0) { - diff = (- *xa + hscale - 1)/ hscale; - dst->x1 += diff; - *xa += diff * hscale; - } - delta = *xb - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *xb -= diff * hscale; - } - if(*xa >= *xb) return FALSE; - - if(*ya < 0) { - diff = (- *ya + vscale - 1)/ vscale; - dst->y1 += diff; - *ya += diff * vscale; - } - delta = *yb - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *yb -= diff * vscale; - } - if(*ya >= *yb) return FALSE; + ScreenPtr pScreen; + FBLinearPtr new_linear; - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} + if(linear) { + if(linear->size >= size) + return linear; + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; -/* - * OVERLAY DRAWING FUNCTIONS - */ + xf86FreeOffscreenLinear(linear); + } + pScreen = screenInfo.screens[pScrn->scrnIndex]; -static void -TDFXResetVideoOverlay(ScrnInfoPtr pScrn) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, + NULL, NULL, NULL); - /* reset the video */ - pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; - pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); - pTDFX->writeLong(pTDFX, RGBMAXDELTA, 0x0080808); - pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); - pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); -} + if(!new_linear) { + int max_size; + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, + PRIORITY_EXTREME); -static void -TDFXStopVideoOverlay(ScrnInfoPtr pScrn, pointer data, Bool cleanup) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + if(max_size < size) + return NULL; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, + NULL, NULL, NULL); + } - if(cleanup) { - if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; - pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); - } - if(pTDFX->overlayBuffer) { - xf86FreeOffscreenLinear(pTDFX->overlayBuffer); - pTDFX->overlayBuffer = NULL; - } - pPriv->videoStatus = 0; - } else { - if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - pPriv->videoStatus |= OFF_TIMER; - pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - } - } + return new_linear; } - static void -TDFXDisplayVideoOverlay( +TDFXDisplayVideo( ScrnInfoPtr pScrn, int id, int offset, @@ -849,28 +546,31 @@ TDFXDisplayVideoOverlay( short drw_w, short drw_h ){ TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + TDFXPortPrivPtr pPriv = pTDFX->adaptor->pPortPrivates[0].ptr; int dudx, dvdy; dudx = (src_w << 20) / drw_w; dvdy = (src_h << 20) / drw_h; offset += ((left >> 16) & ~1) << 1; + left = (left & 0x0001ffff) << 3; pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; pTDFX->ModeReg.vidcfg |= 0x00000320; - if(drw_w != src_w) pTDFX->ModeReg.vidcfg |= (1 << 14); - if(drw_h != src_h) pTDFX->ModeReg.vidcfg |= (1 << 15); - if(id == FOURCC_UYVY) pTDFX->ModeReg.vidcfg |= (6 << 21); - else pTDFX->ModeReg.vidcfg |= (5 << 21); - if(pScrn->depth == 8) pTDFX->ModeReg.vidcfg |= (1 << 11); + if(drw_w != src_w) pTDFX->ModeReg.vidcfg |= (1 << 14); + if(drw_h != src_h) pTDFX->ModeReg.vidcfg |= (1 << 15); + if(id == FOURCC_UYVY) pTDFX->ModeReg.vidcfg |= (6 << 21); + else pTDFX->ModeReg.vidcfg |= (5 << 21); + if(pScrn->depth == 8) pTDFX->ModeReg.vidcfg |= (1 << 11); if(pPriv->filterQuality) pTDFX->ModeReg.vidcfg |= (3 << 16); pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); - pTDFX->writeLong(pTDFX, VIDOVERLAYSTARTCOORDS, dstBox->x1 | (dstBox->y1 << 12)); - pTDFX->writeLong(pTDFX, VIDOVERLAYENDSCREENCOORDS, (dstBox->x2 - 1) | ((dstBox->y2 - 1) << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYSTARTCOORDS, + dstBox->x1 | (dstBox->y1 << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYENDSCREENCOORDS, + (dstBox->x2 - 1) | ((dstBox->y2 - 1) << 12)); pTDFX->writeLong(pTDFX, VIDOVERLAYDUDX, dudx); pTDFX->writeLong(pTDFX, VIDOVERLAYDUDXOFFSETSRCWIDTH, left | (src_w << 20)); pTDFX->writeLong(pTDFX, VIDOVERLAYDVDY, dvdy); @@ -885,7 +585,7 @@ TDFXDisplayVideoOverlay( static int -TDFXPutImageOverlay( +TDFXPutImage( ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, @@ -900,10 +600,8 @@ TDFXPutImageOverlay( TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; INT32 xa, xb, ya, yb; unsigned char *dst_start; - int pitch, new_size, offset; - int s2offset = 0, s3offset = 0; - int srcPitch = 0, srcPitch2 = 0; - int dstPitch; + int pitch, new_size, offset, s2offset, s3offset; + int srcPitch, srcPitch2, dstPitch; int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; @@ -919,6 +617,9 @@ TDFXPutImageOverlay( * */ + /* make the compiler happy */ + s2offset = s3offset = srcPitch2 = 0; + if(src_w > drw_w) drw_w = src_w; if(src_h > drw_h) drw_h = src_h; @@ -934,7 +635,7 @@ TDFXPutImageOverlay( dstBox.y2 = drw_y + drw_h; if(!TDFXClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) - return Success; + return Success; dstBox.x1 -= pScrn->frameX0; dstBox.x2 -= pScrn->frameX0; @@ -947,71 +648,78 @@ TDFXPutImageOverlay( switch(id) { case FOURCC_YV12: case FOURCC_I420: - dstPitch = ((width << 1) + 3) & ~3; - new_size = ((dstPitch * height) + bpp - 1) / bpp; - srcPitch = (width + 3) & ~3; - s2offset = srcPitch * height; - srcPitch2 = ((width >> 1) + 3) & ~3; - s3offset = (srcPitch2 * (height >> 1)) + s2offset; - break; + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width + 3) & ~3; + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; case FOURCC_UYVY: case FOURCC_YUY2: default: - dstPitch = ((width << 1) + 3) & ~3; - new_size = ((dstPitch * height) + bpp - 1) / bpp; - srcPitch = (width << 1); - break; + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width << 1); + break; } - if(!(pTDFX->overlayBuffer = TDFXAllocateMemoryLinear(pScrn, pTDFX->overlayBuffer, new_size))) - return BadAlloc; + if(!(pTDFX->videoScratch = TDFXAllocateMemory(pScrn, pTDFX->videoScratch, + new_size))) + { + return BadAlloc; + } - /* copy data */ + /* copy data */ top = ya >> 16; left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; - offset = (pTDFX->overlayBuffer->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; + offset = (pTDFX->videoScratch->offset * bpp) + + (top * dstPitch) + pTDFX->fbOffset; dst_start = pTDFX->FbBase + offset; switch(id) { case FOURCC_YV12: case FOURCC_I420: - top &= ~1; - dst_start += left << 1; - tmp = ((top >> 1) * srcPitch2) + (left >> 1); - s2offset += tmp; - s3offset += tmp; - if(id == FOURCC_I420) { - tmp = s2offset; - s2offset = s3offset; - s3offset = tmp; - } - nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - TDFXCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, - buf + s3offset, dst_start, srcPitch, srcPitch2, - dstPitch, nlines, npixels); - break; + top &= ~1; + dst_start += left << 1; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if(id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + TDFXCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; case FOURCC_UYVY: case FOURCC_YUY2: default: - left <<= 1; - buf += (top * srcPitch) + left; - nlines = ((yb + 0xffff) >> 16) - top; - dst_start += left; - TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels << 1); - break; + left <<= 1; + buf += (top * srcPitch) + left; + nlines = ((yb + 0xffff) >> 16) - top; + dst_start += left; + TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; } + /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, - GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); } - TDFXDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + TDFXDisplayVideo(pScrn, id, offset, width, height, dstPitch, + xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -1021,112 +729,75 @@ TDFXPutImageOverlay( } -static void -TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; - - if(pPriv->videoStatus & TIMER_MASK) { - if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < time) { - pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; - pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); - pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = time + FREE_DELAY; - } - } else - if(pPriv->videoStatus & FREE_TIMER) { - if(pPriv->freeTime < time) { - if(pTDFX->overlayBuffer) { - xf86FreeOffscreenLinear(pTDFX->overlayBuffer); - pTDFX->overlayBuffer = NULL; - } - pPriv->videoStatus = 0; - pTDFX->VideoTimerCallback = NULL; - } - } - } else /* shouldn't get here */ - pTDFX->VideoTimerCallback = NULL; -} - - -/* - * MEMORY MANAGEMENT - */ - - -static FBAreaPtr -TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - ScreenPtr pScreen; - FBAreaPtr new_area; - - if (area) { - if ((area->box.x2 - area->box.x1 >= width) && - (area->box.y2 - area->box.y1 >= height)) - return area; - - if (xf86ResizeOffscreenArea(area, width, height)) - return area; - - xf86FreeOffscreenArea(area); - } - - pScreen = screenInfo.screens[pScrn->scrnIndex]; - - new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); - - if (!new_area) { - int max_width, max_height; +static int +TDFXQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; - xf86QueryLargestOffscreenArea(pScreen, &max_width, &max_height, pTDFX->cpp, 0, PRIORITY_EXTREME); + if(*w > 2048) *w = 2048; + if(*h > 2048) *h = 2048; - if (max_width < width || max_height < height) - return NULL; + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; - xf86PurgeUnlockedOffscreenAreas(pScreen); - new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); - } + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } - return new_area; + return size; } - -static FBLinearPtr -TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size) +static void +TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time) { - ScreenPtr pScreen; - FBLinearPtr new_linear; - - if(linear) { - if(linear->size >= size) - return linear; - - if(xf86ResizeOffscreenLinear(linear, size)) - return linear; - - xf86FreeOffscreenLinear(linear); - } - - pScreen = screenInfo.screens[pScrn->scrnIndex]; - - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); - - if(!new_linear) { - int max_size; - - xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, PRIORITY_EXTREME); - - if(max_size < size) - return NULL; - - xf86PurgeUnlockedOffscreenAreas(pScreen); - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); - } + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->adaptor->pPortPrivates[0].ptr; - return new_linear; + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < time) { + if(pTDFX->videoScratch) { + xf86FreeOffscreenLinear(pTDFX->videoScratch); + pTDFX->videoScratch = NULL; + } + pPriv->videoStatus = 0; + pTDFX->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + pTDFX->VideoTimerCallback = NULL; } + #endif /* !XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h index a925b22ca..c754a6c3e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.8 2000/12/01 14:29:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.10 2000/12/20 01:30:47 mvojkovi Exp $ */ /* Voodoo Banshee driver version 1.0.1 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp deleted file mode 100644 index a25063e3a..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp +++ /dev/null @@ -1,81 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp,v 1.8 2000/12/11 20:18:37 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH TRIDENT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -trident \- Trident video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qtrident\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B trident -is an XFree86 driver for Trident video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -1, 4, 8, 15, 16, and 24. Multi-head configurations -are supported. The XvImage extension is supported on all Blade and Image -series cards. Currently the ZOOM feature doesn't work properly on the Image -series. -.SH SUPPORTED HARDWARE -The -.B trident -driver supports PCI,AGP and ISA video cards based on the following -Trident chips: -.TP 12 -.B Blade -Blade3D, CyberBlade series i1, i7 (DSTN), i1, i1 (DSTN), Ai1, Ai1 (DSTN), -CyberBlade/e4 -.TP 12 -.B Image -3DImage975, 3DImage985, Cyber9520, Cyber9525, Cyber9397, Cyber9397DVD -.TP 12 -.B ProVidia -9682, 9685, Cyber9382, Cyber9385, Cyber9388 -.TP 12 -.B TGUI -9440AGi, 9660, 9680 -.TP 12 -.B 8900 -8900D (ISA) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the SW cursor. Default: off. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. Default: off. -.TP -.BI "Option \*qCyberShadow\*q \*q" boolean \*q -For Cyber chipsets only, turn off shadow registers. If you only see -a partial display - this may be the option for you. Default: on. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -NOTE: Default is 0 for depth 15 and 24. This needs fixing. -Default: undefined. -.TP -.BI "Option \*qNoPciBurst\*q \*q" boolean \*q -Turn off PCI burst mode, PCI Bursting is on by default. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHOR -Author: Alan Hourihane diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp deleted file mode 100644 index 45fe633cd..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp,v 1.6 2000/12/11 20:18:39 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH TSENG __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -tseng \- Tseng Labs video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qtseng\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B tseng -is an XFree86 driver for Tseng Labs video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B tseng -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp deleted file mode 100644 index e18e938d5..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp +++ /dev/null @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp,v 1.5 2000/12/11 20:18:40 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH V4L __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -v4l \- Video 4 Linux driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qv4l\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B v4l -is an XFree86 driver for Video 4 Linux. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B v4l -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c index edc2421b2..0847547d4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c @@ -1,3 +1,4 @@ +#define DEBUG /* * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) * @@ -24,9 +25,9 @@ * dealings in this Software without prior written authorization from * Conectiva Linux. * - * Authors: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br> + * Authors: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.8 2000/12/02 15:31:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.12 2001/02/16 01:45:45 dawes Exp $ */ #include "vesa.h" @@ -68,6 +69,8 @@ static void VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); static void SaveFonts(ScrnInfoPtr pScrn); static void RestoreFonts(ScrnInfoPtr pScrn); +static Bool +VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); static void *VESAWindowPlanar(ScreenPtr pScrn, CARD32 row, CARD32 offset, int mode, CARD32 *size); @@ -139,19 +142,33 @@ static const char *fbSymbols[] = { "xf4bppScreenInit", "afbScreenInit", "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif "cfbScreenInit", "mfbScreenInit", + "cfb24_32ScreenInit", NULL }; static const char *shadowSymbols[] = { - "ShadowInit", + "shadowAlloc", + "shadowInit", + "shadowUpdatePacked", + "shadowUpdatePlanar4", + "shadowUpdatePlanar4x8", + NULL +}; + +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", NULL }; +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86SetDDCproperties", + NULL}; + #ifdef XFree86LOADER /* Module loader interface */ @@ -173,7 +190,7 @@ static XF86ModuleVersionInfo vesaVersionRec = /* * This data is accessed by the loader. The name must be the module name - * followed by "ModuleInit". + * followed by "ModuleData". */ XF86ModuleData vesaModuleData = { &vesaVersionRec, vesaSetup, NULL }; @@ -186,7 +203,11 @@ vesaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) { Initialised = TRUE; xf86AddDriver(&VESA, Module, 0); - LoaderRefSymLists(fbSymbols, shadowSymbols, NULL); + LoaderRefSymLists(fbSymbols, + shadowSymbols, + vbeSymbols, + ddcSymbols, + NULL); return (pointer)TRUE; } @@ -378,29 +399,30 @@ static Bool VESAPreInit(ScrnInfoPtr pScrn, int flags) { VESAPtr pVesa; - VBEInfoBlock *vbe; + VbeInfoBlock *vbe; DisplayModePtr pMode, tmp; - ModeInfoBlock *mode; + VbeModeInfoBlock *mode; ModeInfoData *data = NULL; char *mod = NULL; const char *reqSym = NULL; Gamma gzeros = {0.0, 0.0, 0.0}; rgb rzeros = {0, 0, 0}; - vbeInfoPtr pVbe; pointer pVbeModule, pDDCModule; int i; if (flags & PROBE_DETECT) return (FALSE); - /* Load int10 module */ - if (!xf86LoadSubModule(pScrn, "int10")) - return (FALSE); - pVesa = VESAGetRec(pScrn); pVesa->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); pVesa->device = xf86GetDevFromEntity(pScrn->entityList[0], pScrn->entityInstanceList[0]); + /* Load vbe module */ + if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) + return (FALSE); + if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) + return (FALSE); + if (pVesa->pEnt->location.type == BUS_PCI) { pVesa->pciInfo = xf86GetPciInfoForEntity(pVesa->pEnt->index); pVesa->pciTag = pciTag(pVesa->pciInfo->bus, pVesa->pciInfo->device, @@ -433,175 +455,24 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) xf86SetGamma(pScrn, gzeros); - if ((pVesa->pInt = xf86InitInt10(pVesa->pEnt->index)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Int10 initialization failed.\n"); - return (FALSE); - } - - if ((pVesa->block = xf86Int10AllocPages(pVesa->pInt, 1, &pVesa->page)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Cannot allocate one scratch page in real mode memory.\n"); - return (FALSE); - } - - vbe = VESAGetVBEInfo(pScrn); + vbe = VBEGetVBEInfo(pVesa->pVbe); pVesa->major = (unsigned)(vbe->VESAVersion >> 8); pVesa->minor = vbe->VESAVersion & 0xff; pVesa->vbeInfo = vbe; pScrn->videoRam = vbe->TotalMemory * 64 * 1024; if (pVesa->major >= 2) { - /* Load vbe module */ - if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) - return (FALSE); - if ((pVbe = VBEInit(pVesa->pInt, pVesa->pEnt->index)) == NULL) - return (FALSE); - /* Load ddc module */ if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) return (FALSE); - if ((pVesa->monitor = vbeDoEDID(pVbe, pDDCModule)) != NULL) { + if ((pVesa->monitor = vbeDoEDID(pVesa->pVbe, pDDCModule)) != NULL) { xf86PrintEDID(pVesa->monitor); -#ifdef DEBUG - ErrorF("Monitor data blocks:\n"); - ErrorF("VENDOR: name %s - id %d - serial %d - week %d - year %d\n", - pVesa->monitor->vendor.name, pVesa->monitor->vendor.prod_id, - pVesa->monitor->vendor.serial, pVesa->monitor->vendor.week, - pVesa->monitor->vendor.year); - ErrorF("EDID: Version %d - Revision %d\n", - pVesa->monitor->ver.version, - pVesa->monitor->ver.revision); - ErrorF("FEATURES:\n input: type %d - voltage %d - setup %d - sync %d\n" - " size: %d x %d\n gamma: %f\n dpms: %d\n type: %d\n" - " misc: %d\n redx %d - redy %d\n greenx %d - greeny %d\n" - " bluex: %d - bluey %d\n whitex %d - whitey\n" - "ESTABLISHED TIMES: %d %d %d\n" - "STD TIMINGS:\n", - pVesa->monitor->features.input_type, - pVesa->monitor->features.input_voltage, - pVesa->monitor->features.input_setup, - pVesa->monitor->features.input_sync, - pVesa->monitor->features.hsize, pVesa->monitor->features.vsize, - pVesa->monitor->features.gamma, - pVesa->monitor->features.dpms, - pVesa->monitor->features.display_type, - pVesa->monitor->features.msc, pVesa->monitor->features.redx, - pVesa->monitor->features.redy, - pVesa->monitor->features.greenx, pVesa->monitor->features.greeny, - pVesa->monitor->features.bluex, pVesa->monitor->features.bluey, - pVesa->monitor->features.whitex, pVesa->monitor->features.whitey, - pVesa->monitor->timings1.t1, - pVesa->monitor->timings1.t2, - pVesa->monitor->timings1.t_manu); - for (i = 0; i < 8; i++) { - ErrorF(" %d %d %d %d\n", - pVesa->monitor->timings2[i].hsize, - pVesa->monitor->timings2[i].vsize, - pVesa->monitor->timings2[i].refresh, - pVesa->monitor->timings2[i].id); - } - ErrorF("DETAILED MONITOR SECTION:\n"); - for (i = 0; i < 4; i++) { - int j; - - ErrorF(" type "); - switch (pVesa->monitor->det_mon[i].type) { - case DT: - ErrorF("DT\n"); - ErrorF(" clock: %d\n" - " hactive: %d\n hblanking: %d\n" - " vactive: %d\n vblanking: %d\n" - " hsyncoff: %d\n hsyncwidth: %d\n" - " vsyncoff: %d\n vsyncwidth: %d\n" - " hsize: %d\n vsize: %d\n" - " hborder: %d\n vborder: %d\n" - " interlaced: %d\n stereo: %d\n" - " sync: %d\n misc: %d\n", - pVesa->monitor->det_mon[i].section.d_timings.clock, - pVesa->monitor->det_mon[i].section.d_timings.h_active, - pVesa->monitor->det_mon[i].section.d_timings.h_blanking, - pVesa->monitor->det_mon[i].section.d_timings.v_active, - pVesa->monitor->det_mon[i].section.d_timings.v_blanking, - pVesa->monitor->det_mon[i].section.d_timings.h_sync_off, - pVesa->monitor->det_mon[i].section.d_timings.h_sync_width, - pVesa->monitor->det_mon[i].section.d_timings.v_sync_off, - pVesa->monitor->det_mon[i].section.d_timings.v_sync_width, - pVesa->monitor->det_mon[i].section.d_timings.h_size, - pVesa->monitor->det_mon[i].section.d_timings.v_size, - pVesa->monitor->det_mon[i].section.d_timings.h_border, - pVesa->monitor->det_mon[i].section.d_timings.v_border, - pVesa->monitor->det_mon[i].section.d_timings.interlaced, - pVesa->monitor->det_mon[i].section.d_timings.stereo, - pVesa->monitor->det_mon[i].section.d_timings.sync, - pVesa->monitor->det_mon[i].section.d_timings.misc); - break; - case DS_SERIAL: - ErrorF("SERIAL\n"); - ErrorF(" serial: %s\n", pVesa->monitor->det_mon[i].section.serial); - break; - case DS_ASCII_STR: - ErrorF("ASCII_STR\n"); - ErrorF(" ascii_str: %s\n", pVesa->monitor->det_mon[i].section.ascii_data); - break; - case DS_NAME: - ErrorF("NAME\n"); - ErrorF(" name: %s\n", pVesa->monitor->det_mon[i].section.name); - break; - case DS_RANGES: - ErrorF("RANGES\n"); - ErrorF(" ranges: minv %d - maxv %d - minh %d - maxh %d - maxclock %d\n", - pVesa->monitor->det_mon[i].section.ranges.min_v, - pVesa->monitor->det_mon[i].section.ranges.max_v, - pVesa->monitor->det_mon[i].section.ranges.min_h, - pVesa->monitor->det_mon[i].section.ranges.min_h, - pVesa->monitor->det_mon[i].section.ranges.max_clock); - break; - case DS_WHITE_P: - ErrorF("WHITE_P\n"); - for (j = 0; j < 2; j++) - ErrorF(" index %d - whitex %d - whitey %d - whitegamma %d\n", - pVesa->monitor->det_mon[i].section.wp[j].index, - pVesa->monitor->det_mon[i].section.wp[j].white_x, - pVesa->monitor->det_mon[i].section.wp[j].white_y, - pVesa->monitor->det_mon[i].section.wp[j].white_gamma); - break; - case DS_STD_TIMINGS: - ErrorF("STD_TIMINGS\n"); - for (j = 0; j < 5; j++) - ErrorF(" %d %d %d %d\n", - pVesa->monitor->det_mon[i].section.std_t[j].hsize, - pVesa->monitor->det_mon[i].section.std_t[j].vsize, - pVesa->monitor->det_mon[i].section.std_t[j].refresh, - pVesa->monitor->det_mon[i].section.std_t[j].id); - break; - default: - ErrorF(" UNKNOWN\n"); - break; - } - } -#endif } - /* unload modules */ - xf86UnloadSubModule(pVbeModule); xf86UnloadSubModule(pDDCModule); } -#ifdef DEBUG - ErrorF("%c%c%c%c %d.%d - %s\n", - vbe->VESASignature[0], vbe->VESASignature[1], - vbe->VESASignature[2], vbe->VESASignature[3], - pVesa->major, pVesa->minor, vbe->OEMStringPtr); - - if (pVesa->major >= 2) - ErrorF("Vendor: %s\nProduct: %s\nProductRev: %s\nSoftware Rev: %d.%d\n", - vbe->OemVendorNamePtr, vbe->OemProductNamePtr, - vbe->OemProductRevPtr, (unsigned)vbe->OemSoftwareRev >> 8, - vbe->OemSoftwareRev & 0xff); -#endif - /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); @@ -616,56 +487,8 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) while (vbe->VideoModePtr[i] != 0xffff) { int id = vbe->VideoModePtr[i++]; - if ((mode = VESAGetModeInfo(pScrn, id)) == NULL) - continue; - - if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ - !(mode->ModeAttributes & (1 << 4)) || /* text mode */ - (pScrn->bitsPerPixel != 1 && !(mode->ModeAttributes & (1 << 3))) || /* monochrome */ - (mode->BitsPerPixel > 8 && - (mode->RedMaskSize + mode->GreenMaskSize + - mode->BlueMaskSize != pScrn->depth)) || - /* only linear mode, but no PhysBasePtr */ - ((mode->ModeAttributes & (1 << 6)) && - (mode->ModeAttributes & (1 << 7)) && !mode->PhysBasePtr) || - ((mode->ModeAttributes & (1 << 6)) && - !(mode->ModeAttributes & (1 << 7))) || - mode->BitsPerPixel != pScrn->bitsPerPixel) { - VESAFreeModeInfo(mode); + if ((mode = VBEGetModeInfo(pVesa->pVbe, id)) == NULL) continue; - } - - pMode = xcalloc(sizeof(DisplayModeRec), 1); - pMode->prev = pMode->next = NULL; - - pMode->status = MODE_OK; - pMode->type = M_T_DEFAULT;/*M_T_BUILTIN;*/ - - /* for adjust frame */ - pMode->HDisplay = mode->XResolution; - pMode->VDisplay = mode->YResolution; - - data = xcalloc(sizeof(ModeInfoData), 1); - data->mode = id; - data->data = mode; - pMode->PrivSize = sizeof(ModeInfoData); - pMode->Private = (INT32*)data; - - if (pScrn->modePool == NULL) { - pScrn->modePool = pMode; - pMode->next = pMode->prev = pMode; - } - else { - tmp = pScrn->modePool; - - tmp->prev = pMode; - while (tmp->next != pScrn->modePool) - tmp = tmp->next; - tmp->next = pMode; - pMode->prev = tmp; - pMode->next = pScrn->modePool; - } - #ifdef DEBUG ErrorF("Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); ErrorF(" ModeAttributes: 0x%x\n", mode->ModeAttributes); @@ -714,6 +537,54 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) } } #endif + + if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ + !(mode->ModeAttributes & (1 << 4)) || /* text mode */ + (pScrn->bitsPerPixel != 1 && !(mode->ModeAttributes & (1 << 3))) || /* monochrome */ + (mode->BitsPerPixel > 8 && + (mode->RedMaskSize + mode->GreenMaskSize + + mode->BlueMaskSize != pScrn->depth)) || + /* only linear mode, but no PhysBasePtr */ + ((mode->ModeAttributes & (1 << 6)) && + (mode->ModeAttributes & (1 << 7)) && !mode->PhysBasePtr) || + ((mode->ModeAttributes & (1 << 6)) && + !(mode->ModeAttributes & (1 << 7))) || + mode->BitsPerPixel != pScrn->bitsPerPixel) { + VBEFreeModeInfo(mode); + continue; + } + + pMode = xcalloc(sizeof(DisplayModeRec), 1); + pMode->prev = pMode->next = NULL; + + pMode->status = MODE_OK; + pMode->type = M_T_DEFAULT;/*M_T_BUILTIN;*/ + + /* for adjust frame */ + pMode->HDisplay = mode->XResolution; + pMode->VDisplay = mode->YResolution; + + data = xcalloc(sizeof(ModeInfoData), 1); + data->mode = id; + data->data = mode; + pMode->PrivSize = sizeof(ModeInfoData); + pMode->Private = (INT32*)data; + + if (pScrn->modePool == NULL) { + pScrn->modePool = pMode; + pMode->next = pMode->prev = pMode; + } + else { + tmp = pScrn->modePool; + + tmp->prev = pMode; + while (tmp->next != pScrn->modePool) + tmp = tmp->next; + tmp->next = pMode; + pMode->prev = tmp; + pMode->next = pScrn->modePool; + } + } #ifdef DEBUG @@ -813,7 +684,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) /* copy the "interesting" information */ memcpy((char*)pMode + from, (char*)tmp + from, to - from); data = (ModeInfoData*)pMode->Private; - data->block = xcalloc(sizeof(CRTCInfoBlock), 1); + data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1); data->block->HorizontalTotal = pMode->HTotal; data->block->HorizontalSyncStart = pMode->HSyncStart; data->block->HorizontalSyncEnd = pMode->HSyncEnd; @@ -858,6 +729,9 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) if (pVesa->shadowFB) { mod = "fb"; reqSym = "fbScreenInit"; + pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; + + xf86LoaderReqSymbols("fbPictureInit", NULL); } else { switch (pScrn->bitsPerPixel) { @@ -877,29 +751,11 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) } break; case 0x4: /* Packed pixel */ - mod = "fb"; - reqSym = "fbScreenInit"; - - switch (pScrn->bitsPerPixel) { - case 8: - case 16: - case 32: - break; - case 24: - if (pVesa->pix24bpp == 32) { - mod = "xf24_32bpp"; - reqSym = "cfb24_32ScreenInit"; - } - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported bpp: %d", pScrn->bitsPerPixel); - return FALSE; - } - break; case 0x6: /* Direct Color */ mod = "fb"; reqSym = "fbScreenInit"; + pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; + xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { case 8: @@ -907,7 +763,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) case 32: break; case 24: - if (pVesa->pix24bpp == 32) { + if (pVesa->pix24bpp == 32) { mod = "xf24_32bpp"; reqSym = "cfb24_32ScreenInit"; } @@ -936,9 +792,6 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) return (FALSE); } xf86LoaderReqSymbols(reqSym, NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif return (TRUE); } @@ -949,7 +802,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VESAPtr pVesa = VESAGetRec(pScrn); VisualPtr visual; - ModeInfoBlock *mode; + VbeModeInfoBlock *mode; int flags; if (pVesa->mapPhys == 0) { @@ -982,7 +835,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* save current video state */ VESASaveRestore(pScrn, MODE_SAVE); - pVesa->savedPal = VESASetGetPaletteData(pScrn, FALSE, 0, 256, + pVesa->savedPal = VBESetGetPaletteData(pVesa->pVbe, FALSE, 0, 256, NULL, FALSE, FALSE); /* set first video mode */ @@ -1019,14 +872,23 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return (FALSE); case 0x3: /* Planar */ if (pVesa->shadowFB) { - if (!fbScreenInit(pScreen, - pVesa->shadowPtr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) + if (pScrn->depth == 1) { + if (!mfbScreenInit(pScreen, + pVesa->shadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth)) + return FALSE; + } else { + if (!fbScreenInit(pScreen, + pVesa->shadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - } - else { + fbPictureInit(pScreen, 0, 0); + } + } else { switch (pScrn->bitsPerPixel) { case 1: if (!xf1bppScreenInit(pScreen, pVesa->base, @@ -1052,38 +914,11 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } break; case 0x4: /* Packed pixel */ - switch (pScrn->bitsPerPixel) { - case 24: - if (pVesa->pix24bpp == 32) { - if (!cfb24_32ScreenInit(pScreen, - pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth)) - return (FALSE); - break; - } - case 8: - case 16: - case 32: - if (!fbScreenInit(pScreen, - pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) - return (FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported bpp: %d", pScrn->bitsPerPixel); - return FALSE; - } - break; case 0x6: /* Direct Color */ switch (pScrn->bitsPerPixel) { case 24: if (pVesa->pix24bpp == 32) { - if (!cfb24_32ScreenInit(pScreen, + if (!cfb24_32ScreenInit(pScreen, pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, @@ -1100,6 +935,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); + fbPictureInit(pScreen, 0, 0); break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1109,9 +945,6 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) break; } -#ifdef RENDER - fbPictureInit(pScreen, 0, 0); -#endif if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1133,7 +966,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ShadowWindowProc window; if (mode->MemoryModel == 3) { /* Planar */ - if (pScrn->bitsPerPixel == 8) + if (pScrn->bitsPerPixel == 8) update = shadowUpdatePlanar4x8; else update = shadowUpdatePlanar4; @@ -1216,7 +1049,7 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen) VESAPtr pVesa = VESAGetRec(pScrn); VESASaveRestore(xf86Screens[scrnIndex], MODE_RESTORE); - VESASetGetPaletteData(pScrn, TRUE, 0, 256, + VBESetGetPaletteData(pVesa->pVbe, TRUE, 0, 256, pVesa->savedPal, FALSE, TRUE); VESAUnmapVidMem(pScrn); @@ -1255,9 +1088,9 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) if (pVesa->mapPhys != 0xa0000) mode |= 1 << 14; - if (VESASetVBEMode(pScrn, mode, data->block) == FALSE) { + if (VBESetVBEMode(pVesa->pVbe, mode, data->block) == FALSE) { if ((data->block || (data->mode & (1 << 11))) && - VESASetVBEMode(pScrn, (mode & ~(1 << 11)), NULL) == TRUE) { + VBESetVBEMode(pVesa->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { /* Some cards do not like setting the clock. * Free it as it will not be any longer useful */ @@ -1275,10 +1108,10 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) !((data->data->WinBSegment == 0) && (data->data->WinBAttributes == 0)); if (data->data->XResolution != pScrn->virtualX) - VESASetLogicalScanline(pScrn, pScrn->virtualX); + VBESetLogicalScanline(pVesa->pVbe, pScrn->virtualX); if (pScrn->bitsPerPixel >= 8 && pVesa->vbeInfo->Capabilities[0] & 0x01) - VESASetGetDACPaletteFormat(pScrn, 8); + VBESetGetDACPaletteFormat(pVesa->pVbe, 8); pScrn->vtSema = TRUE; @@ -1288,10 +1121,9 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) static void VESAAdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScrn; + VESAPtr pVesa = VESAGetRec(xf86Screens[scrnIndex]); - pScrn = xf86Screens[scrnIndex]; - VESASetDisplayStart(pScrn, x, y, TRUE); + VBESetDisplayStart(pVesa->pVbe, x, y, TRUE); } static void @@ -1348,13 +1180,12 @@ VESAWindowPlanar(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - ModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; int window; int mask = 1 << (offset & 3); outb(0x3c4, 2); outb(0x3c5, mask); - offset = (offset >> 2) + pVesa->maxBytesPerScanline * row; window = offset / (data->WinGranularity * 1024); pVesa->windowAoffset = window * data->WinGranularity * 1024; @@ -1382,7 +1213,7 @@ VESAWindowWindowed(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - ModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; int window; offset += pVesa->maxBytesPerScanline * row; @@ -1416,14 +1247,14 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, (colors[j].green << 8) | (colors[j].red << 16); if (j != idx) { - VESASetGetPaletteData(pScrn, TRUE, base, idx - base, + VBESetGetPaletteData(pVesa->pVbe, TRUE, base, idx - base, pVesa->pal + base, FALSE, TRUE); idx = base = j; } } if (idx - 1 == indices[i - 1]) - VESASetGetPaletteData(pScrn, TRUE, base, idx - base, + VBESetGetPaletteData(pVesa->pVbe, TRUE, base, idx - base, pVesa->pal + base, FALSE, TRUE); #else #define WriteDacWriteAddr(value) outb(VGA_DAC_WRITE_ADDR, value) @@ -1668,281 +1499,28 @@ VESASaveScreen(ScreenPtr pScreen, int mode) return (TRUE); } -VBEInfoBlock * -VESAGetVBEInfo(ScrnInfoPtr pScrn) -{ - VESAPtr pVesa; - VBEInfoBlock *block = NULL; - int i, pStr, pModes; - char *str; - CARD16 major, minor, *modes; - - pVesa = VESAGetRec(pScrn); - bzero(pVesa->block, sizeof(VBEInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 00h Return Super VGA information - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - - pVesa->block[0] = 'V'; - pVesa->block[1] = 'B'; - pVesa->block[2] = 'E'; - pVesa->block[3] = '2'; - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f00; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(VBEInfoBlock), 1); - block->VESASignature[0] = pVesa->block[0]; - block->VESASignature[1] = pVesa->block[1]; - block->VESASignature[2] = pVesa->block[2]; - block->VESASignature[3] = pVesa->block[3]; - - block->VESAVersion = *(CARD16*)(pVesa->block + 4); - major = (unsigned)block->VESAVersion >> 8; - minor = block->VESAVersion & 0xff; - - pStr = *(CARD32*)(pVesa->block + 6); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OEMStringPtr = strdup(str); - - block->Capabilities[0] = pVesa->block[10]; - block->Capabilities[1] = pVesa->block[11]; - block->Capabilities[2] = pVesa->block[12]; - block->Capabilities[3] = pVesa->block[13]; - - pModes = *(CARD32*)(pVesa->block + 14); - modes = xf86int10Addr(pVesa->pInt, FARP(pModes)); - i = 0; - while (modes[i] != 0xffff) - i++; - block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); - memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); - block->VideoModePtr[i] = 0xffff; - - block->TotalMemory = *(CARD16*)(pVesa->block + 18); - - if (major < 2) - memcpy(&block->OemSoftwareRev, pVesa->block + 20, 236); - else { - block->OemSoftwareRev = *(CARD16*)(pVesa->block + 20); - pStr = *(CARD32*)(pVesa->block + 22); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemVendorNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 26); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 30); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductRevPtr = strdup(str); - memcpy(&block->Reserved, pVesa->block + 34, 222); - memcpy(&block->OemData, pVesa->block + 256, 256); - } - - return (block); -} - -void -VESAFreeVBEInfo(VBEInfoBlock *block) -{ - xfree(block->OEMStringPtr); - xfree(block->VideoModePtr); - if (((unsigned)block->VESAVersion >> 8) >= 2) { - xfree(block->OemVendorNamePtr); - xfree(block->OemProductNamePtr); - xfree(block->OemProductRevPtr); - } - xfree(block); -} - -Bool -VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *block) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 02h Set Super VGA video mode - BX := Video mode - D0-D8 := Mode number - D9-D10 := Reserved (must be 0) - D11 := 0 Use current default refresh rate - := 1 Use user specified CRTC values for refresh rate - D12-13 Reserved for VBE/AF (must be 0) - D14 := 0 Use windowed frame buffer model - := 1 Use linear/flat frame buffer model - D15 := 0 Clear video memory - := 1 Don't clear video memory - ES:DI := Pointer to CRTCInfoBlock structure - - Output: AX = Status - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f02; - pVesa->pInt->bx = mode; - if (block) { - pVesa->pInt->bx |= 1 << 11; - memcpy(pVesa->block, block, sizeof(CRTCInfoBlock)); - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - } - - xf86ExecX86int10(pVesa->pInt); - - return (pVesa->pInt->ax == 0x4f); -} - -Bool -VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 03h Return current video mode - - Output: - AX := Status - BX := Current video mode - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f03; - - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax == 0x4f) { - *mode = pVesa->pInt->bx; - - return (TRUE); - } - - return (FALSE); -} - -ModeInfoBlock * -VESAGetModeInfo(ScrnInfoPtr pScrn, int mode) +static int +VESABankSwitch(ScreenPtr pScreen, unsigned int iBank) { VESAPtr pVesa; - ModeInfoBlock *block = NULL; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; pVesa = VESAGetRec(pScrn); - bzero(pVesa->block, sizeof(ModeInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 01h Return Super VGA mode information - CX := Super VGA video mode - (mode number must be one of those returned by Function 0) - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f01; - pVesa->pInt->cx = mode; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(ModeInfoBlock), 1); - - block->ModeAttributes = *(CARD16*)pVesa->block; - block->WinAAttributes = pVesa->block[2]; - block->WinBAttributes = pVesa->block[3]; - block->WinGranularity = *(CARD16*)(pVesa->block + 4); - block->WinSize = *(CARD16*)(pVesa->block + 6); - block->WinASegment = *(CARD16*)(pVesa->block + 8); - block->WinBSegment = *(CARD16*)(pVesa->block + 10); - block->WinFuncPtr = *(CARD32*)(pVesa->block + 12); - block->BytesPerScanline = *(CARD16*)(pVesa->block + 16); - - /* mandatory information for VBE 1.2 and above */ - block->XResolution = *(CARD16*)(pVesa->block + 18); - block->YResolution = *(CARD16*)(pVesa->block + 20); - block->XCharSize = pVesa->block[22]; - block->YCharSize = pVesa->block[23]; - block->NumberOfPlanes = pVesa->block[24]; - block->BitsPerPixel = pVesa->block[25]; - block->NumberOfBanks = pVesa->block[26]; - block->MemoryModel = pVesa->block[27]; - block->BankSize = pVesa->block[28]; - block->NumberOfImages = pVesa->block[29]; - block->Reserved = pVesa->block[30]; - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - block->RedMaskSize = pVesa->block[31]; - block->RedFieldPosition = pVesa->block[32]; - block->GreenMaskSize = pVesa->block[33]; - block->GreenFieldPosition = pVesa->block[34]; - block->BlueMaskSize = pVesa->block[35]; - block->BlueFieldPosition = pVesa->block[36]; - block->RsvdMaskSize = pVesa->block[37]; - block->RsvdFieldPosition = pVesa->block[38]; - block->DirectColorModeInfo = pVesa->block[39]; - - /* Mandatory information for VBE 2.0 and above */ - if (pVesa->major >= 2) { - block->PhysBasePtr = *(CARD32*)(pVesa->block + 40); - block->Reserved32 = *(CARD32*)(pVesa->block + 44); - block->Reserved16 = *(CARD16*)(pVesa->block + 48); - - /* Mandatory information for VBE 3.0 and above */ - if (pVesa->major >= 3) { - block->LinBytesPerScanLine = *(CARD16*)(pVesa->block + 50); - block->BnkNumberOfImagePages = pVesa->block[52]; - block->LinNumberOfImagePages = pVesa->block[53]; - block->LinRedMaskSize = pVesa->block[54]; - block->LinRedFieldPosition = pVesa->block[55]; - block->LinGreenMaskSize = pVesa->block[56]; - block->LinGreenFieldPosition = pVesa->block[57]; - block->LinBlueMaskSize = pVesa->block[58]; - block->LinBlueFieldPosition = pVesa->block[59]; - block->LinRsvdMaskSize = pVesa->block[60]; - block->LinRsvdFieldPosition = pVesa->block[61]; - block->MaxPixelClock = *(CARD32*)(pVesa->block + 62); - memcpy(&block->Reserved2, pVesa->block + 66, 188); - } - else - memcpy(&block->LinBytesPerScanLine, pVesa->block + 50, 206); + if (pVesa->curBank == iBank) + return (0); + if (!VBEBankSwitch(pVesa->pVbe, iBank, 0)) + return (1); + if (pVesa->bankSwitchWindowB) { + if (!VBEBankSwitch(pVesa->pVbe, iBank, 1)) + return (1); } - else - memcpy(&block->PhysBasePtr, pVesa->block + 40, 216); - - return (block); -} + pVesa->curBank = iBank; -void -VESAFreeModeInfo(ModeInfoBlock *block) -{ - xfree(block); + return (0); } Bool -VESASaveRestore(ScrnInfoPtr pScrn, int function) +VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) { VESAPtr pVesa; @@ -1951,376 +1529,55 @@ VESASaveRestore(ScrnInfoPtr pScrn, int function) pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 00h Return save/restore state buffer size - CX := Requested states - D0 = Save/restore video hardware state - D1 = Save/restore video BIOS data state - D2 = Save/restore video DAC state - D3 = Save/restore Super VGA state - - Output: - AX = Status - BX = Number of 64-byte blocks to hold the state buffer - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 01h Save Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 02h Restore Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - */ /* Query amount of memory to save state */ if (function == MODE_QUERY || (function == MODE_SAVE && pVesa->state == NULL)) { - int npages; /* Make sure we save at least this information in case of failure */ - (void)VESAGetVBEMode(pScrn, &pVesa->stateMode); + (void)VBEGetVBEMode(pVesa->pVbe, &pVesa->stateMode); SaveFonts(pScrn); if (pVesa->major > 1) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = 0; - pVesa->pInt->cx = 0x000f; - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (FALSE); + if (!VBESaveRestore(pVesa->pVbe,function,(pointer)&pVesa->state, + &pVesa->stateSize,&pVesa->statePage)) + return FALSE; - npages = (pVesa->pInt->bx * 64) / 4096 + 1; - if ((pVesa->state = xf86Int10AllocPages(pVesa->pInt, npages, - &pVesa->statePage)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Cannot allocate memory to save SVGA state.\n"); - return (FALSE); - } } } /* Save/Restore Super VGA state */ if (function != MODE_QUERY) { - int ax_reg = 0; + Bool retval = TRUE; if (pVesa->major > 1) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = function; - pVesa->pInt->cx = 0x000f; - if (function == MODE_RESTORE) memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); - pVesa->pInt->es = SEG_ADDR(pVesa->statePage); - pVesa->pInt->bx = SEG_OFF(pVesa->statePage); - xf86ExecX86int10(pVesa->pInt); - ax_reg = pVesa->pInt->ax; + if ((retval = VBESaveRestore(pVesa->pVbe,function, + (pointer)&pVesa->state, + &pVesa->stateSize,&pVesa->statePage)) + && function == MODE_SAVE) { + /* don't rely on the memory not being touched */ + if (pVesa->pstate == NULL) + pVesa->pstate = xalloc(pVesa->stateSize); + memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); + } } if (function == MODE_RESTORE) { - VESASetVBEMode(pScrn, pVesa->stateMode, NULL); + VBESetVBEMode(pVesa->pVbe, pVesa->stateMode, NULL); RestoreFonts(pScrn); } - if (pVesa->major > 1) { - if (ax_reg != 0x4f) - return (FALSE); - - if (function == MODE_SAVE && pVesa->pstate == NULL) { - /* don't rely on the memory not being touched */ - pVesa->stateSize = pVesa->pInt->bx * 64; - pVesa->pstate = xalloc(pVesa->stateSize); - memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); - } - } - } - - return (TRUE); -} - -int -VESABankSwitch(ScreenPtr pScreen, unsigned int iBank) -{ - VESAPtr pVesa; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - pVesa = VESAGetRec(pScrn); - if (pVesa->curBank == iBank) - return (0); - pVesa->curBank = iBank; - - /* - Input: - AH := 4Fh Super VGA support - AL := 05h - - Output: - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f05; - pVesa->pInt->bx = 0; - pVesa->pInt->dx = iBank; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (1); - - if (pVesa->bankSwitchWindowB) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f05; - pVesa->pInt->bx = 1; - pVesa->pInt->dx = iBank; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (1); - } - - return (0); -} - -Bool -VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, - int *pixels, int *bytes, int *max) -{ - VESAPtr pVesa; - - if (command < SCANWID_SET || command > SCANWID_GET_MAX) - return (FALSE); - - pVesa = VESAGetRec(pScrn); - /* - Input: - AX := 4F06h VBE Set/Get Logical Scan Line Length - BL := 00h Set Scan Line Length in Pixels - := 01h Get Scan Line Length - := 02h Set Scan Line Length in Bytes - := 03h Get Maximum Scan Line Length - CX := If BL=00h Desired Width in Pixels - If BL=02h Desired Width in Bytes - (Ignored for Get Functions) - - Output: - AX := VBE Return Status - BX := Bytes Per Scan Line - CX := Actual Pixels Per Scan Line - (truncated to nearest complete pixel) - DX := Maximum Number of Scan Lines - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f06; - pVesa->pInt->bx = command; - if (command == SCANWID_SET || command == SCANWID_SET_BYTES) - pVesa->pInt->cx = width; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (FALSE); + if (!retval) + return (FALSE); - if (command == SCANWID_GET || command == SCANWID_GET_MAX) { - if (pixels) - *pixels = pVesa->pInt->cx; - if (bytes) - *bytes = pVesa->pInt->bx; - if (max) - *max = pVesa->pInt->dx; } return (TRUE); } -Bool -VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f07; - pVesa->pInt->bx = wait_retrace ? 0x80 : 0x00; - pVesa->pInt->cx = x; - pVesa->pInt->dx = y; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (FALSE); - - return (TRUE); -} - -Bool -VESAGetDisplayStart(ScrnInfoPtr pScrn, int *x, int *y) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f07; - pVesa->pInt->bx = 0x01; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (FALSE); - - *x = pVesa->pInt->cx; - *y = pVesa->pInt->dx; - - return (TRUE); -} - -int -VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits) -{ - VESAPtr pVesa = VESAGetRec(pScrn); - - /* - Input: - AX := 4F08h VBE Set/Get Palette Format - BL := 00h Set DAC Palette Format - := 01h Get DAC Palette Format - BH := Desired bits of color per primary - (Set DAC Palette Format only) - - Output: - AX := VBE Return Status - BH := Current number of bits of color per primary - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f08; - if (!bits) - pVesa->pInt->bx = 0x01; - else - pVesa->pInt->bx = (bits & 0x00ff) << 8; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (0); - - return (bits != 0 ? bits : (pVesa->pInt->bx >> 8) & 0x00ff); -} - -CARD32 * -VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace) -{ - VESAPtr pVesa = VESAGetRec(pScrn); - - /* - Input: - (16-bit) - AX := 4F09h VBE Load/Unload Palette Data - BL := 00h Set Palette Data - := 01h Get Palette Data - := 02h Set Secondary Palette Data - := 03h Get Secondary Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:DI := Table of palette values (see below for format) - - Output: - AX := VBE Return Status - - - Input: - (32-bit) - BL := 00h Set Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:EDI := Table of palette values (see below for format) - DS := Selector for memory mapped registers - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f09; - if (!secondary) - pVesa->pInt->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; - else - pVesa->pInt->bx = set ? 2 : 3; - pVesa->pInt->cx = num; - pVesa->pInt->dx = first; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - if (set) - memcpy(pVesa->block, data, num * sizeof(CARD32)); - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - if (set) - return (data); - - data = xalloc(num * sizeof(CARD32)); - memcpy(data, pVesa->block, num * sizeof(CARD32)); - - return (data); -} - -VESApmi * -VESAGetVBEpmi(ScrnInfoPtr pScrn) -{ - VESAPtr pVesa; - VESApmi *pmi; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 0Ah Protected Mode Interface - BL := 00h Return Protected Mode Table - - Output: - AX := Status - ES := Real Mode Segment of Table - DI := Offset of Table - CX := Lenght of Table including protected mode code in bytes (for copying purposes) - (All other registers are preserved) - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f0a; - pVesa->pInt->bx = 0; - pVesa->pInt->di = 0; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - pmi = xalloc(sizeof(VESApmi)); - pmi->seg_tbl = pVesa->pInt->es; - pmi->tbl_off = pVesa->pInt->di; - pmi->tbl_len = pVesa->pInt->cx; - - return (pmi); -} /*********************************************************************** * DGA stuff diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp deleted file mode 100644 index de0e2cecd..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp +++ /dev/null @@ -1,53 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp,v 1.2 2000/12/11 20:18:42 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH VESA __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -vesa \- Generic VESA video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qvesa\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B vesa -is an XFree86 driver for generic VESA video cards. It can drive most -VESA-compatible video cards, but only makes use of the basic standard -VESA core that is common to these cards. The driver supports depths 8, 15 -16 and 24. -.SH SUPPORTED HARDWARE -The -.B vesa -driver supports most VESA-compatible video cards. There are some known -exceptions, and those should be listed here. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the presence of VESA-compatible hardware. The -.B ChipSet -name may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"vesa" -.RE -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: on. - -This option is recommended for performance reasons. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86cfg(1), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Paulo Csar Pereira de Andrade. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h index 1233698a1..2fd47666c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h @@ -26,7 +26,7 @@ * * Authors: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.5 2000/12/01 19:56:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.7 2001/02/15 20:00:14 eich Exp $ */ #ifndef _VESA_H_ @@ -66,10 +66,6 @@ /* Dga definitions */ #include "dgaproc.h" -#ifdef RENDER -#include "picturestr.h" -#endif - #include "xf86Resources.h" #include "xf86RAC.h" @@ -77,6 +73,8 @@ #include "xf4bpp.h" #include "fb.h" #include "afb.h" +#include "mfb.h" +#include "cfb24_32.h" #define VESA_VERSION 4000 #define VESA_NAME "VESA" @@ -85,16 +83,14 @@ #define VESA_MINOR_VERSION 0 #define VESA_PATCHLEVEL 0 -typedef struct _VBEInfoBlock VBEInfoBlock; -typedef struct _ModeInfoBlock ModeInfoBlock; -typedef struct _CRTCInfoBlock CRTCInfoBlock; +/*XXX*/ typedef struct _VESARec { - xf86Int10InfoPtr pInt; + vbeInfoPtr pVbe; EntityInfoPtr pEnt; CARD16 major, minor; - VBEInfoBlock *vbeInfo; + VbeInfoBlock *vbeInfo; GDevPtr device; pciVideoPtr pciInfo; PCITAG pciTag; @@ -106,7 +102,6 @@ typedef struct _VESARec CARD8 *state, *pstate; /* SVGA state */ int statePage, stateSize, stateMode; int page; - CARD8 *block; int pix24bpp; CARD32 *pal, *savedPal; CARD8 *fonts; @@ -119,213 +114,11 @@ typedef struct _VESARec int nDGAMode; } VESARec, *VESAPtr; -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) - -#ifndef __GNUC__ -#define __attribute__(a) -#endif - typedef struct _ModeInfoData { int mode; - ModeInfoBlock *data; - CRTCInfoBlock *block; + VbeModeInfoBlock *data; + VbeCRTCInfoBlock *block; } ModeInfoData; -/* - * INT 0 - */ -struct _VBEInfoBlock { - /* VESA 1.2 fields */ - CARD8 VESASignature[4]; /* VESA */ - CARD16 VESAVersion; /* Higher byte major, lower byte minor */ - /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ - CARD8 Capabilities[4]; /* Capabilities of the video environment */ - - /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ - - CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ - /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ - - /* VESA 2 fields */ - CARD16 OemSoftwareRev; /* VBE implementation Software revision */ - /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ - /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ - /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ - CARD8 Reserved[222]; /* Reserved for VBE implementation */ - CARD8 OemData[256]; /* Data Area for OEM Strings */ -} __attribute__((packed)); - -/* Return Super VGA Information */ -VBEInfoBlock *VESAGetVBEInfo(ScrnInfoPtr pScrn); -void VESAFreeVBEInfo(VBEInfoBlock *block); - -/* - * INT 1 - */ -struct _ModeInfoBlock { - CARD16 ModeAttributes; /* mode attributes */ - CARD8 WinAAttributes; /* window A attributes */ - CARD8 WinBAttributes; /* window B attributes */ - CARD16 WinGranularity; /* window granularity */ - CARD16 WinSize; /* window size */ - CARD16 WinASegment; /* window A start segment */ - CARD16 WinBSegment; /* window B start segment */ - CARD32 WinFuncPtr; /* real mode pointer to window function */ - CARD16 BytesPerScanline; /* bytes per scanline */ - - /* Mandatory information for VBE 1.2 and above */ - CARD16 XResolution; /* horizontal resolution in pixels or characters */ - CARD16 YResolution; /* vertical resolution in pixels or characters */ - CARD8 XCharSize; /* character cell width in pixels */ - CARD8 YCharSize; /* character cell height in pixels */ - CARD8 NumberOfPlanes; /* number of memory planes */ - CARD8 BitsPerPixel; /* bits per pixel */ - CARD8 NumberOfBanks; /* number of banks */ - CARD8 MemoryModel; /* memory model type */ - CARD8 BankSize; /* bank size in KB */ - CARD8 NumberOfImages; /* number of images */ - CARD8 Reserved; /* 1 */ /* reserved for page function */ - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - CARD8 RedMaskSize; /* size of direct color red mask in bits */ - CARD8 RedFieldPosition; /* bit position of lsb of red mask */ - CARD8 GreenMaskSize; /* size of direct color green mask in bits */ - CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ - CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ - CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ - CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ - CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ - CARD8 DirectColorModeInfo; /* direct color mode attributes */ - - /* Mandatory information for VBE 2.0 and above */ - CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ - CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ - CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ - - /* Mandatory information for VBE 3.0 and above */ - CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ - CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ - CARD8 LinNumberOfImagePages; /* number of images for linear modes */ - CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ - CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ - CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ - CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ - CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ - CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ - CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ - CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ - CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ - CARD8 Reserved2[189]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); - -/* Return VBE Mode Information */ -ModeInfoBlock *VESAGetModeInfo(ScrnInfoPtr pScrn, int mode); -void VESAFreeModeInfo(ModeInfoBlock *block); - -/* - * INT2 - */ -#define CRTC_DBLSCAN (1<<0) -#define CRTC_INTERLACE (1<<1) -#define CRTC_NHSYNC (1<<2) -#define CRTC_NVSYNC (1<<3) - -struct _CRTCInfoBlock { - CARD16 HorizontalTotal; /* Horizontal total in pixels */ - CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ - CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ - CARD16 VerticalTotal; /* Vertical total in lines */ - CARD16 VerticalSyncStart; /* Vertical sync start in lines */ - CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ - CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ - CARD32 PixelClock; /* Pixel clock in units of Hz */ - CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ - CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); -/* CRTCInfoBlock is in the VESA 3.0 specs */ - -Bool VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *crtc); - -/* - * INT 3 - */ -Bool VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode); - -/* - * INT 4 - */ -/* Save/Restore Super VGA video state */ -/* function values are (values stored in VESAPtr): - * 0 := query & allocate amount of memory to save state - * 1 := save state - * 2 := restore state - * - * function 0 called automatically if function 1 called without - * a previous call to function 0. - */ -#define MODE_QUERY 0 -#define MODE_SAVE 1 -#define MODE_RESTORE 2 -Bool VESASaveRestore(ScrnInfoPtr pScrn, int function); - -/* - * INT 6 - */ -#define SCANWID_SET 0 -#define SCANWID_GET 1 -#define SCANWID_SET_BYTES 2 -#define SCANWID_GET_MAX 3 -#define VESASetLogicalScanline(pScrn, width) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_SET, \ - width, NULL, NULL, NULL) -#define VESASetLogicalScanlineBytes(pScrn, width) \ - VESASetGetLogicalScanlineLength(pScrn, width, SCANWID_SET_BYTES, \ - NULL, NULL, NULL) -#define VESAGetLogicalScanline(pScrn, pixels, bytes, max) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET, NULL, \ - pixels, bytes, max) -#define VESAGetMaxLogicalScanline(pScrn, pixels, bytes, max) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET_MAX, \ - NULL, pixels, bytes, max) -Bool VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, - int *pixels, int *bytes, int *max); - -/* - * INT 7 - */ -/* 16 bit code */ -Bool VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace); -Bool VESAGetDisplayStart(ScrnInfoPtr pScrn, int *x, int *y); - -/* - * INT 8 - */ -/* if bits is 0, then it is a GET */ -int VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits); - -/* - * INT 9 - */ -/* - * If getting a palette, the data argument is not used. It will return - * the data. - * If setting a palette, it will return the pointer received on success, - * NULL on failure. - */ -CARD32 *VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace); -#define VESAFreePaletteData(data) xfree(data) - -/* - * INT A - */ -typedef struct _VESApmi { - int seg_tbl; - int tbl_off; - int tbl_len; -} VESApmi; - -VESApmi *VESAGetVBEpmi(ScrnInfoPtr pScrn); -#define VESAFreeVBEpmi(pmi) xfree(pmi) #endif /* _VESA_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp b/xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp deleted file mode 100644 index 7eb5749cc..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp +++ /dev/null @@ -1,66 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp,v 1.2 1999/08/28 09:01:08 dawes Exp $ -.TH VGA __drivermansuffix__ "Version 3.9.16" "XFree86" -.SH NAME -vga \- Generic VGA video driver -.SH SYNOPSIS -.B "Section ""Device""" -.br -.BI " Identifier """ devname """" -.br -.B " Driver ""vga""" -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B vga -is an XFree86 driver for generic VGA video cards. It can drive most -VGA-compatible video cards, but only makes use of the basic standard -VGA core that is common to these cards. The driver supports depths 1, 4 -and 8. All relevant visual types are supported at each depth. -Multi-head configurations -are supported in combination with some other drivers, but only when the -.B vga -driver is driving the primary head. -.SH SUPPORTED HARDWARE -The -.B vga -driver supports most VGA-compatible video cards. There are some known -exceptions, and those should be listed here. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the presence of VGA-compatible hardware. The -.B ChipSet -name may optionally be specified in the config file -.B """Device""" -section, and will override the auto-detection: -.PP -.RS 4 -"generic" -.RE -.PP -The driver will only use 64k of video memory for depth 1 and depth 8 operation, -and 256k of video memory for depth 4 (this is the standard VGA limit). -.PP -When operating at depth 8, only a single built-in 320x200 video mode is -available. At other depths there is more flexibility regarding mode choice. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option ""ShadowFB"" """ boolean """ -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. - -This option is recommended for performance reasons when running at depths -1 and 4, especially when using modern PCI-based hardware. It is required -when using those depths in a multi-head configuration where one or more -of the other screens is operating at a different depth. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1) -.SH AUTHORS -Authors include: Marc La France, David Dawes, and Dirk Hohndel. |