diff options
author | dawes <dawes> | 2000-08-16 17:22:14 +0000 |
---|---|---|
committer | dawes <dawes> | 2000-08-16 17:22:14 +0000 |
commit | c0fd23c13d4bbe14ab6908e8444aefe0ed22176c (patch) | |
tree | 92961082f3488f6b17e2244463e623cc6a0f08fa | |
parent | 30722f5171428576252260bfe13e2dcd8f622a4d (diff) |
Import of XFree86 4.0.1bX_4_0_1b
439 files changed, 31119 insertions, 7974 deletions
diff --git a/xc/Imakefile b/xc/Imakefile index b7bcb7df9..e9515ea3b 100644 --- a/xc/Imakefile +++ b/xc/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/138 1997/12/29 16:37:30 kaleb $ -XCOMM $XFree86: xc/Imakefile,v 3.19 2000/05/31 15:02:54 eich Exp $ +XCOMM $XFree86: xc/Imakefile,v 3.20 2000/07/07 20:06:55 tsi Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -50,6 +50,10 @@ VerifyOS:: @echo binutils version: `expr LinuxBinUtilsMajorVersion / 10`.`expr LinuxBinUtilsMajorVersion % 10` @echo "" #endif +#if defined(GccMajorVersion) && defined(GccMinorVersion) + @echo GCC version: GccMajorVersion"."GccMinorVersion + @echo "" +#endif includes:: MakeDir($(BUILDINCDIR)) diff --git a/xc/config/cf/DGUX.cf b/xc/config/cf/DGUX.cf index 16bc13285..b383099ee 100644 --- a/xc/config/cf/DGUX.cf +++ b/xc/config/cf/DGUX.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/DGUX.cf,v 1.4 1998/12/29 13:00:46 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/DGUX.cf,v 1.5 2000/07/07 20:06:56 tsi Exp $ /* Copyright Takis Psarogiannakopoulos <takis@pmms.cam.ac.uk> * This is the DG/ux configuration file of X11R6.3 */ @@ -66,9 +66,6 @@ XCOMM platform: $XFree86: xc/config/cf/DGUX.cf,v 1.4 1998/12/29 13:00:46 dawes #define HasSockets YES #define BuildServer YES #define HasSharedLibraries YES /* to build shared libs */ -#define HasGcc YES -#define HasGcc2 YES -#define HasGcc2ForCplusplus YES #define HasCplusplus YES #define HasGnuMake YES /* Added for 3.2Xc */ #define UseGnuMalloc YES @@ -91,13 +88,6 @@ XCOMM platform: $XFree86: xc/config/cf/DGUX.cf,v 1.4 1998/12/29 13:00:46 dawes #define StandardDefines -DDGUX -DSVR4 -Di386 -D__ix86 -D_DGUX_SOURCE -D_LITTLE_ENDIAN -D_PENTIUM_CHANGE -#ifndef HasGcc2 -#define HasGcc2 YES /* We suppose that your DG/ux has gcc-dg.2.7.2.88 */ -#endif /* Do NOT use native DG/ux gcc, it is faulty in general */ -#ifndef HasGcc -#define HasGcc HasGcc2 -#endif - #define PositionIndependentCFlags -fpic #define PositionIndependentCplusplusFlags -fpic @@ -182,7 +172,7 @@ XCOMM platform: $XFree86: xc/config/cf/DGUX.cf,v 1.4 1998/12/29 13:00:46 dawes #endif #ifndef StaticLibrary -#if !HasGcc +#ifndef HasGcc #define StaticLibrary(libpath,libname) -B static Concat(-L,libpath) Concat(-l,libname) -B dynamic #endif #endif diff --git a/xc/config/cf/FreeBSD.cf b/xc/config/cf/FreeBSD.cf index f99692d51..4f5657a8f 100644 --- a/xc/config/cf/FreeBSD.cf +++ b/xc/config/cf/FreeBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $TOG: FreeBSD.cf /main/21 1997/10/05 20:42:34 kaleb $ XCOMM XCOMM XCOMM -XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.95 2000/06/23 19:50:58 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.97 2000/08/01 23:38:45 dawes Exp $ #ifndef UseElfFormat #define UseElfFormat DefaultToElfFormat @@ -39,10 +39,7 @@ XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.95 2000/06/23 19:50:58 da XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) (OsRelVersion) -#define HasGcc YES -#define HasGcc2 YES #define HasCplusplus YES -#define HasGcc2ForCplusplus YES #define GccUsesGas YES #define UseGas YES #define GnuCpp YES @@ -495,11 +492,10 @@ InstallManPageAliasesBase(file,destdir,aliases) #define ServerExtraSysLibs IoLibrary /* - * A hack to work around an optimisation problem with the compiler on - * FreeBSD 4.0-current in late 1999/early 2000. + * A hack to work around an optimization problem with gcc 2.95.2 */ #if OSMajorVersion >= 4 -#define FreeBSDGccOptBug +#define GccOptBug295 #endif #include <bsdLib.rules> diff --git a/xc/config/cf/Imake.cf b/xc/config/cf/Imake.cf index bb9b64710..fd1dc23fa 100644 --- a/xc/config/cf/Imake.cf +++ b/xc/config/cf/Imake.cf @@ -17,7 +17,7 @@ XCOMM $TOG: Imake.cf /main/30 1998/04/28 13:55:25 barstow $ * * 4. Create a .cf file with the name given by MacroFile. */ -XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.58 2000/06/30 17:15:05 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.60 2000/08/11 17:27:10 dawes Exp $ #if defined(clipper) || defined(__clipper__) # undef clipper @@ -26,6 +26,16 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.58 2000/06/30 17:15:05 dawes Exp $ # define IngrArchitecture #endif /* clipper */ +#ifdef __CYGWIN__ +#define MacroIncludeFile <cygwin.cf> +#define MacroFile cygwin.cf +#define cygwinArchitecture +#define i386Architecture +#undef i386 +#undef __i386__ +#undef _X86_ +#endif /* CYGWIN */ + #ifdef ultrix # define MacroIncludeFile <ultrix.cf> # define MacroFile ultrix.cf @@ -593,6 +603,12 @@ XCOMM Keep cpp from replacing path elements containing i486/i586/i686 # endif # undef __alpha__ # endif /* __alpha__ */ +# ifdef __arm__ +# define Arm32Architecture +# undef arm +# undef __arm +# undef __arm__ +# endif # ifdef mc68000 # define Mc68020Architecture # undef mc68000 diff --git a/xc/config/cf/Imakefile b/xc/config/cf/Imakefile index dfc9a5904..5d189e281 100644 --- a/xc/config/cf/Imakefile +++ b/xc/config/cf/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/38 1996/11/07 14:43:46 kaleb $ -XCOMM $XFree86: xc/config/cf/Imakefile,v 3.22 2000/01/21 02:29:34 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imakefile,v 3.23 2000/08/09 23:40:08 dawes Exp $ XCOMM Some compilers generate fatal errors if an -L directory does XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use. @@ -23,6 +23,7 @@ site.def RULEFILES = \ Imake.rules \ Motif.rules \ +cygwin.rules \ Win32.rules \ X11.rules \ bsdLib.rules \ @@ -55,6 +56,7 @@ Motif.tmpl \ Server.tmpl \ ServerLib.tmpl \ Threads.tmpl \ +cygwin.tmpl \ WinLib.tmpl \ X11.tmpl \ bsdLib.tmpl \ @@ -82,6 +84,7 @@ Mips.cf \ NetBSD.cf \ OpenBSD.cf \ Oki.cf \ +cygwin.cf \ Win32.cf \ apollo.cf \ bsd.cf \ diff --git a/xc/config/cf/NetBSD.cf b/xc/config/cf/NetBSD.cf index b103ca849..c138f94f6 100644 --- a/xc/config/cf/NetBSD.cf +++ b/xc/config/cf/NetBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $XConsortium: NetBSD.cf /main/16 1996/10/31 14:47:14 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.83 2000/06/14 00:16:02 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.84 2000/07/07 20:06:56 tsi Exp $ #ifndef OSName @@ -75,12 +75,6 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe /* * Compiler Features */ -#undef HasGcc -#define HasGcc YES -#define HasGcc2 YES -#ifndef HasGcc2ForCplusplus -#define HasGcc2ForCplusplus YES -#endif #define GccUsesGas YES #define UseGas YES #define GnuCpp YES diff --git a/xc/config/cf/OpenBSD.cf b/xc/config/cf/OpenBSD.cf index 95d6e383e..2750309e1 100644 --- a/xc/config/cf/OpenBSD.cf +++ b/xc/config/cf/OpenBSD.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.37 2000/06/24 17:43:44 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.39 2000/08/01 23:38:45 dawes Exp $ XCOMM #ifndef OSName @@ -80,12 +80,6 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe /* * Compiler Features */ -#undef HasGcc -#define HasGcc YES -#define HasGcc2 YES -#ifndef HasGcc2ForCplusplus -#define HasGcc2ForCplusplus YES -#endif #define GccUsesGas YES #define UseGas YES #define GnuCpp YES @@ -381,11 +375,10 @@ install:: fonts.alias @@\ # endif /* - * A hack to work around an optimisation problem with the compiler on - * OpenBSD 2.6-current in late 1999/early 2000. + * A hack to work around an optimization problem with gcc 2.95.2 */ # if OSMajorVersion == 2 && OSMinorVersion >= 6 -# define FreeBSDGccOptBug +# define GccOptBug295 # endif # include <xfree86.cf> diff --git a/xc/config/cf/QNX4.cf b/xc/config/cf/QNX4.cf index 28135238f..340b60c82 100644 --- a/xc/config/cf/QNX4.cf +++ b/xc/config/cf/QNX4.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/QNX4.cf,v 1.2 2000/01/21 02:29:34 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/QNX4.cf,v 1.3 2000/07/07 20:06:56 tsi Exp $ #define StripInstalledPrograms NO #define BuildServer YES @@ -30,8 +30,6 @@ XCOMM in the generated Makefile #define OSDefines -DQNX4 -DQNX -D__QNX__ -DNO_REGEX -DSTRINGS_ALIGNED -D__i386__ #define SourceDefines -D_POSIX_SOURCE -#define HasGcc NO -#define HasGcc2 NO #define DoRanlibCmd NO #undef ArCmd #define ArCmd wlib -b -c -p=256 diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index 311899052..29d80c9b8 100644 --- a/xc/config/cf/X11.tmpl +++ b/xc/config/cf/X11.tmpl @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.71 2000/06/25 20:17:28 dawes Exp $ +XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.73 2000/08/09 02:57:19 tsi Exp $ /*************************************************************************** * * @@ -274,12 +274,6 @@ XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.71 2000/06/25 20:17:28 dawes Exp $ #ifndef BuildXvLibrary #define BuildXvLibrary BuildXvExt #endif -#ifndef BuildXantiExt -#define BuildXantiExt NO -#endif -#ifndef BuildXantiLibrary -#define BuildXantiLibrary BuildXantiExt -#endif #ifndef BuildGlxExt #define BuildGlxExt NO #endif @@ -526,6 +520,9 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #define GlxDefines /**/ #endif #endif +#ifndef MesaSrcDir +#define MesaSrcDir $(TOP)/extras/Mesa +#endif #ifndef ShmDefines #if HasShm #define ShmDefines -DMITSHM @@ -666,14 +663,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #endif #endif -#ifndef XantiExtensionDefines -#if BuildXantiExt -#define XantiExtensionDefines -DXANTI -#else -#define XantiExtensionDefines /**/ -#endif -#endif - #ifndef RECORDDefines #if BuildRECORD #define RECORDDefines -DXRECORD @@ -750,7 +739,7 @@ FCHOWN_DEFINES = -DHAS_FCHOWN XCMiscDefines RECORDDefines \ PexDefines ShmDefines XieDefines BigReqDefines VidModeExtensionDefines \ XF86MiscExtensionDefines DBEDefines DPMSDefines EVIDefines \ - ScreenSaverExtensionDefines XvExtensionDefines XantiExtensionDefines \ + ScreenSaverExtensionDefines XvExtensionDefines \ GlxDefines FontCacheExtensionDefines SiteExtensionDefines #endif #define ExtensionDefines BaseExtensionDefines ExtensionOSDefines @@ -1185,6 +1174,7 @@ XCOMM X Window System make variables; these need to be coordinated with rules EXTINCSRC = $(XTOP)/include/extensions FTSOURCEDIR = FreeTypeSrcDir XTTSOURCEDIR = XTrueTypeSrcDir + MESASRCDIR = MesaSrcDir PSWRAPSRC = $(XTOP)/config/pswrap TRANSCOMMSRC = $(LIBSRC)/xtrans TRANS_INCLUDES = -I$(TRANSCOMMSRC) @@ -1418,21 +1408,6 @@ ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir) #endif #endif -#if BuildXantiLibrary -#ifndef SharedLibXanti -#define SharedLibXanti NO -#endif -#ifndef NormalLibXanti -#define NormalLibXanti YES -#endif -#ifndef DebugLibXanti -#define DebugLibXanti NO -#endif -#ifndef ProfileLibXanti -#define ProfileLibXanti NO -#endif -#endif - #if BuildGLXLibrary #ifndef SharedLibGlx #define SharedLibGlx HasSharedLibraries @@ -1622,18 +1597,6 @@ ProjectUnsharedLibReferences(PSRES,psres,$(PSRESLIBSRC),XBuildLibDir) #endif #endif -#if BuildXantiLibrary - XANTILIBSRC = $(LIBSRC)/Xanti -#if SharedLibXanti -#ifndef SharedXantiRev -#define SharedXantiRev 1.0 -#endif -SharedLibReferences(XANTI,Xanti,$(XANTILIBSRC),SOXANTIREV,SharedXantiRev) -#else -ProjectUnsharedLibReferences(XANTI,Xanti,$(XANTILIBSRC),XBuildLibDir) -#endif -#endif - #if BuildGLXLibrary GLXLIBSRC = $(LIBSRC)/GL #if SharedLibGlx @@ -1646,8 +1609,6 @@ ProjectUnsharedLibReferences(GLX,GL,$(GLXLIBSRC),XBuildLibDir) #endif #endif - - #if BuildFontCacheLib # ifndef SharedLibXfontcache # define SharedLibXfontcache NO diff --git a/xc/config/cf/bsdi.cf b/xc/config/cf/bsdi.cf index d2acbd862..b3312ab39 100644 --- a/xc/config/cf/bsdi.cf +++ b/xc/config/cf/bsdi.cf @@ -1,5 +1,5 @@ XCOMM platform: $XConsortium: bsdi.cf /main/22 1996/09/28 16:09:30 rws $ -XCOMM platform: $XFree86: xc/config/cf/bsdi.cf,v 3.30 2000/06/30 17:15:05 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/bsdi.cf,v 3.31 2000/08/01 23:38:45 dawes Exp $ #ifndef OSName #define OSName DefaultOSName @@ -87,6 +87,13 @@ XCOMM xf86site.def # define OptimizedCDebugFlags -O #endif +/* + * A hack to work around an optimization problem with GCC 2.95.2 + */ +#if (OSMajorVersion == 4 && OSMinorVersion == 2) +#define GccOptBug295 +#endif + #define CppCmd /usr/bin/cpp #define TroffCmd groff -Tps #define MkdirHierCmd mkdir -p @@ -160,7 +167,11 @@ XCOMM xf86site.def #define LdPreLib -L$(BUILDLIBDIR) -L$(USRLIBDIR) #endif +#if OSMajorVersion >= 4 #define StandardDefines -D__ELF__ -DCSRG_BASED +#else +#define StandardDefines -DCSRG_BASED +#endif #define InstallCmd /usr/bin/install #define EqnCmd eqn -Tps diff --git a/xc/config/cf/cygwin.cf b/xc/config/cf/cygwin.cf new file mode 100644 index 000000000..b4feccd3e --- /dev/null +++ b/xc/config/cf/cygwin.cf @@ -0,0 +1,170 @@ +XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.1 2000/08/09 23:40:09 dawes Exp $ +XCOMM +XCOMM - changes since B20 Cygwin32 release +XCOMM - avoided tons of "not in XXX directory" messages; +XCOMM - dlls are built stripped; +XCOMM - search for cpp in a default location; +XCOMM - fixed problem with missing netinet/tcp.h; +XCOMM - Added AF_UNIX socket support; +XCOMM - xterm compiles and works; +XCOMM - more libs are built as a DLLs; +XCOMM - all DLLs have different base addresses; +XCOMM - changes since B20 Cygwin32 release +XCOMM - dllwrap is used to build DLLs; +XCOMM - Plan to add WATCOM TCP headers support; +XCOMM - gcc -E is invoked instead of cpp; + +#ifndef OSName +#define OSName Cygwin +#endif +#ifndef OSVendor +#define OSVendor Red Hat Inc. +#endif +#ifndef OSMajorVersion +#define OSMajorVersion 1 +#endif +#ifndef OSMinorVersion +#define OSMinorVersion 1 +#endif +#ifndef OSTeenyVersion 2 +#define OSTeenyVersion +#endif + +XCOMM #define OSDefines -DSYSV -DSYSV386 + +#define ProjectRoot /usr/X11R6 + +#define BuildServer YES + +#ifndef UnixCpp +#define UnixCpp +#endif + +#define HasGcc YES +#define HasGcc2 YES +#define HasGcc2ForCplusplus YES +#define GccUsesGas YES +#define UseGas YES +#define GnuCpp YES +#define HasShadowPasswd NO +#define HasLibCrypt YES +#define HasPutenv YES +#define HasPoll NO +#define HasShm NO +#define Hastcl YES +#define Hastk YES +#define TclLibName tcl80 +#define TkLibName tk80 +#define HasSockets YES +#define GzipFontCompression YES +#define BuildXKB YES +#define BuildXF86MiscExt YES +#define BuildXF86VidModeExt YES /* need -fpcc-struct-return for gcc-2.95.2 or it will fail*/ +#define SharedLibFont NO +#define AvoidNullMakeCommand YES +#define StripInstalledPrograms NO +#define CompressAllFonts YES +#define Malloc0ReturnsNull NO +#define NeedConstPrototypes YES +#define NeedFunctionPrototypes YES +#define NeedNestedPrototypes YES +#define NeedVarargsPrototypes YES +#define NeedWidePrototypes NO +#define SetTtyGroup YES +#define ExpandManNames NO +#define HasDlopen NO +#define HasGnuMake YES +XCOMM #define ExtraLoaderDefines DlopenHack +#define DefaultCCOptions -Wall +#define DefaultGcc2i386Opt -O2 +#define LibraryCDebugFlags -O2 +#define UseGccMakeDepend YES + + + +#define ThreadedX NO +#define HasThreadSafeAPI NO +#define LnCmd ln -s +#define CcCmd gcc +#define CpluplusCmd c++ -fpermissive +#define AsCmd as +XCOMM #define AsCmd gcc -S +#define GccGasOption -DGCCUSESGAS +#define AsmDefines -DUSE_GAS -DGCCUSESGAS +#define LdCmd ld +#define MkdirHierCmd mkdir -p +#define CppCmd cpp +#define YaccCmd byacc +#define LexCmd flex -l +#define LexLib -lfl +#define PreProcessCmd CcCmd -E +XCOMM #define StdIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:../../../../i586-cygwin32/include:'|sed 's,\\\\,/,g'` +XCOMM #define PostIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:/include:'|sed 's,\\\\,/,g'` +#define StdIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,../../../../i686-pc-cygwin/include,'` +#define PostIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,include,'` +#define LdCombineFlags -r +#define OptimizedCDebugFlags -O2 -pedantic -fno-strength-reduce -fpcc-struct-return -fvtable-thunks -m486 +#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE -D_MT -D_X86_ -D__STDC__ -DNO_TCP_H -D__CYGWIN__ -D_XOPEN_SOURCE -D_REENTRANT -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DX_SOURCE +#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC +#define HasWChar32 YES +#define StandardCppDefines -traditional StandardDefines +#define ServerOSDefines XFree86ServerDefines -DDDXTIME -DFD_SETSIZE=256 -DDXOSINIT +#define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT +#define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +#define ConnectionFlags -DTCPCONN -DUNIXCONN +#define ExtraLibraries +#define InstUidFlags -m 4711 +#define UseRgbTxt YES +#define ExtraFilesToClean *.obj *.orig *.rej junk.c *.exe *.dll *.lib *~ + +/* This a must to compile for xfddx display driver, or your server will NOT work on Win32. DO NOT change to NO */ + +#define BuildSurfLibrary YES + +/* The DRM module requires Linux kernel services, thus useless for CYGWIN compilers*/ + +#define BuildXF86DRI NO +#define BuildXF86DRM NO +#define BuildGlxExt YES +#define BuildXinrama YES +#define BuildPlugin NO +#define BuildDPSLibrary YES +XCOMM #define GlxStaticServerLib YES +#define DoLoadableServer NO + +/* Some of these man page defaults are overriden in the above OS sections */ +#ifndef ManSuffix +# define ManSuffix 1x +#endif +#ifndef ManDir +# define ManDir $(MANSOURCEPATH)1 +#endif +#ifndef LibManSuffix +# define LibManSuffix 3x +#endif +#ifndef LibmanDir +# define LibmanDir $(MANSOURCEPATH)3 +#endif +#ifndef FileManSuffix +# define FileManSuffix 5x +#endif +#ifndef FileManDir +# define FileManDir $(MANSOURCEPATH)5 +#endif + +#define TermcapLibrary -ltermcap +#define XnestServer YES +#define BuildXprint YES +#define XprtServer YES +#define XVirtualFramebufferServer YES +#define XWinServer YES +#define UseSmartScheduler NO + +/* --unix option of cygwin make fools the standard MakeFlagsToShellFlags macro */ +#define MakeFlagsToShellFlags(makeflags,shellcmd)\ + for flag in ${MAKEFLAGS} ''; do \ @@\ + case "$$flag" in *=*) ;;--*) ;; *[makeflags]*) shellcmd;; esac; done + +#include <cygwin.rules> +#include <xfree86.cf> +/*#include <xttMod.tmpl>*/ diff --git a/xc/config/cf/cygwin.rules b/xc/config/cf/cygwin.rules new file mode 100644 index 000000000..9ed93be31 --- /dev/null +++ b/xc/config/cf/cygwin.rules @@ -0,0 +1,312 @@ +XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.1 2000/08/09 23:40:09 dawes Exp $ + +#define CPPOnlyAsm(basename,options) RemoveFile(basename.i) @@\ + $(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | grep -v '^\#' > basename.i + + + +/* + * Cygwin shared library rules (DLL versions) + */ +#define HasSharedLibraries YES +#define NeedLibInsideFlag YES +#define ForceNormalLib NO +#define SharedLibXaw NO +#define SharedLibXmu NO +#define SharedLibXt NO +#define SharedLibSM YES +#define SharedLibICE YES +#define SharedLibXext YES +#define SharedLibXie YES +#define SharedLibXi YES +#define SharedLibPex YES +#define SharedLibXtst YES +#define SharedOldX YES +#define SharedLibXp YES +#define SharedLibGL YES +#define SharedLibXpm YES +#define SharedLibFont NO +#define SharedLibXaw6 NO +#define SharedLibgetsurf NO +#define SharedLibDps YES +#define SharedLibDpsTk YES + + +#ifndef SharedDataSeparation +#define SharedDataSeparation NO +#endif +#ifndef SharedCodeDef +#define SharedCodeDef /**/ +#endif +#ifndef SharedLibraryDef +#define SharedLibraryDef /**/ +#endif +#ifndef ShLibIncludeFile +#define ShLibIncludeFile <cygwin.tmpl> +#endif +#ifndef SharedLibraryLoadFlags +#define SharedLibraryLoadFlags -dll /**/ +#endif +#ifndef PositionIndependentCFlags +#define PositionIndependentCFlags -D_DLL +#endif +#ifndef PositionIndependentCplusplusFlags +#define PositionIndependentCplusplusFlags -D_DLL +#endif +#ifndef UseExportLists +#define UseExportLists YES +#endif + +/* + * SharedDepLibraryTarget - generate rules to create a shared library. + */ +#ifndef SharedDepLibraryTarget +#ifdef UseInstalled +#ifndef LinkBuildSonameLibrary +#define LinkBuildSonameLibrary(lib) +#endif +#else +#ifndef LinkBuildSonameLibrary +#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \ + cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .) +#endif +#endif + +#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ +SharedLibraryTarget(libname,rev,solist,down,up) +#endif /* SharedDepLibraryTarget */ + +#ifndef SharedDepModuleTarget +#define SharedDepModuleTarget(name,deps,solist) @@\ +AllTarget(name) @@\ + @@\ +name: deps @@\ + $(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ + @@\ +clean:: @@\ + RemoveFile(name) +#endif /* SharedDepModuleTarget */ + +/* + * SharedLibraryDataTarget - generate rules to create shared data file + */ +#ifndef SharedLibraryDataTarget +#define SharedLibraryDataTarget(libname,rev,salist) +#endif +/* + * InstallSharedLibraryData - generate rules to install the shared library data + */ +#ifndef InstallSharedLibraryData +#define InstallSharedLibraryData(libname,rev,dest) +#endif /* InstallSharedLibraryData */ + +BASE_COUNTER=/tmp/DLL_BASE_COUNTER + +#define MakeDLL(libname,solist) @@\ + if [ -f $(BASE_COUNTER) ]; then true; \ @@\ + else echo 0x67000000 > $(BASE_COUNTER); fi @@\ + dllwrap -s --def libname.def --output-lib Concat3(lib,libname,.a) -o Concat3(lib,libname,.dll) solist junk.o $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)` @@\ + IMAGE_LENGTH=`objdump -x Concat3(lib,libname,.dll) |awk '/SizeOfImage/ {print "0x"$$2}'`; \ @@\ + export IMAGE_LENGTH=`expr '(' \`printf %u $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \ @@\ + export IMAGE_BASE=`cat $(BASE_COUNTER)`; \ @@\ + printf 0x%x `expr \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER) + + +#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ +AllTarget(Concat3(lib,libname,.dll)) @@\ + @@\ +CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\ + @@\ + @@\ +junk.c: @@\ + echo "#include <cygwin/cygwin_dll.h>" >junk.c @@\ + echo "DECLARE_CYGWIN_DLL(dll_main);" >>junk.c @@\ + echo "int WINAPI dll_main(HANDLE a, DWORD reason, void *q)" >>junk.c @@\ + echo "{ return 1; }" >>junk.c @@\ +Concat3(lib,libname,.dll): solist junk.o libname.def @@\ + RemoveFile(LibraryTargetName(libname)) @@\ + RemoveFile(Concat3(lib,libname,.dll)) @@\ + MakeDLL(libname,solist) @@\ + LinkBuildLibrary(Concat3(lib,libname,.a)) @@\ + LinkBuildDLL(Concat3(lib,libname,.dll)) @@\ +clean:: @@\ + RemoveFile(LibraryTargetName(libname)) @@\ + RemoveFile(Concat3(lib,libname,.dll)) @@\ + RemoveFile(junk.o) @@\ + RemoveFile(junk.c) @@\ + RemoveFile($(BASE_COUNTER)) + +#define InstallSharedLibrary(libname,rev,dest) @@\ +InstallTarget(install,LibraryTargetName(libname),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\ +InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR)) + +#define ProgramTargetName(target)target.exe + +/* + * LinkBuildBinary - export a *.exe to exports/bin. + */ +#define LinkBuildBinary(program) @@\ +all:: $(BUILDBINDIR)/program program @@\ + $(BUILDBINDIR)/program: program @@\ + RemoveFile$(@) @@\ + cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/program . + +/* + * LinkBuildDLL - export a .dll to exports/bin. + */ +#ifdef UseInstalled +#define LinkBuildDLL(lib) $(_NULLCMD_) +#else +#define LinkBuildDLL(lib) MakeDir($(BUILDBINDIR)) @@\ + RemoveFile($(BUILDBINDIR)/lib) @@\ + cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib . +#endif + +/* + * LinkBuildBinary - export an .exe to exports/bin. + */ + + +#ifndef LinkBuildBinary +#define LinkBuildBinary +all:: $(BUILDBINDIR)/ProgramTargetName(binary) ProgramTargetName(binary) @@\ + @@\ +$(BUILDBINDIR)/ProgramTargetName(binary): ProgramTargetName(binary) @@\ + MakeDir($(BUILDBINDIR)) @@\ + RemoveFile($(BUILDBINDIR)/ProgramTargetName(binary))) @@\ + cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/ProgramTargetName(binary) . +#endif /* LinkBuildBinary */ + +/* This is to replace an ugly hack in /xc/nls/XLC_LOCALE */ +/* the corresponding Imake.rules rule would be: + define LinkFileSpecial(gotodir,tofile,fromfile) @@\ + @MakeFlagsToShellFlags(i,set +e); \ @@\ + cd dir && (set -x; RemoveFile(tofile); $(LN) fromfile tofile) + */ + +/* And this replaces a similarlry ugly hack in InstallDynamicModule */ + +#ifndef LinkBuildModule +#ifdef UseInstalled +#define LinkBuildModule(module,subdir) $(_NULLCMD_) +#else +#define LinkBuildModule(module,subdir) @@\ + MakeDir($(BUILDMODULEDIR)/subdir) @@\ + RemoveFile($(BUILDMODULEDIR)/subdir/module) @@\ + $(LN) $(BUILDMODULETOP)/$(CURRENT_DIR)/module $(BUILDMODULEDIR)/subdir/module +#endif +#endif /* LinkBuildModule */ + +#ifndef LinkBuildNamedModule +#define LinkBuildNamedModule(module,name) MakeDir($(BUILDMODULEDIR)) @@\ + RemoveFile($(BUILDMODULEDIR)/module) @@\ + $(BUILDMODULEDIR) $(BUILDMODULETOP)/$(CURRENT_DIR)/module name +#endif /* LinkBuildNamedModule */ + +#define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\ +AllTarget(ProgramTargetName(program)) @@\ +ProgramTargetName(program): objects deplibs @@\ + RemoveTargetProgram($@) @@\ + LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\ + @@\ +clean:: @@\ + RemoveFile(ProgramTargetName(program)) + +#define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\ +ProgramTargetName(program): $(objs) $(deplib) @@\ + RemoveTargetProgram($@) @@\ + LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ + @@\ +InstallProgram(program,$(BINDIR)) @@\ +InstallManPage(program,$(MANDIR)) + +#define ComplexProgramTarget(program) @@\ +AllTarget(ProgramTargetName(program)) @@\ + @@\ +ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ + @@\ +DependTarget() @@\ +LintTarget() @@\ + @@\ +clean:: @@\ + RemoveFile(ProgramTargetName(program)) + +#define ComplexProgramTarget_1(program,locallib,syslib) @@\ + OBJS = $(OBJS1) $(OBJS2) $(OBJS3) @@\ + SRCS = $(SRCS1) $(SRCS2) $(SRCS3) @@\ + PROGRAM1 = ProgramTargetName(program) @@\ + @@\ +AllTarget($(PROGRAM1) $(PROGRAM2) $(PROGRAM3)) @@\ + @@\ +ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\ + @@\ +DependTarget() @@\ +LintTarget() @@\ + @@\ +clean:: @@\ + for i in $(PROGRAMS); do $(RM) ProgramTargetName($$i); done + +#define ComplexProgramTarget_2(program,locallib,syslib) @@\ + PROGRAM2 = ProgramTargetName(program) @@\ + @@\ +ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib) + +#define ComplexProgramTarget_3(program,locallib,syslib) @@\ + PROGRAM3 = ProgramTargetName(program) @@\ + @@\ +ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib) + +#define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\ +AllTarget(ProgramTargetName(server)) @@\ +ProgramTargetName(server): subdirs objects libs @@\ + MoveToBakFile($@) @@\ + LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ + @@\ +Concat(load,server): @@\ + MoveToBakFile(ProgramTargetName(server)) @@\ + LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ + @@\ +loadX:: Concat(load,server) @@\ + @@\ +SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ +SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ +PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ +PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ +ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ +ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ + @@\ +InstallProgramWithFlags(server,$(BINDIR),flags) @@\ + @@\ +clean:: @@\ + RemoveFile(ProgramTargetName(server)) + +/* + * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable + * object file instead of a library. + */ +#ifndef ProfiledRelocatableTarget +#define ProfiledRelocatableTarget(objname,objlist) @@\ +AllTarget(Concat(objname,_p.Osuf)) @@\ + @@\ +Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ + RemoveFile($@) @@\ + $(LD) -X -r --oformat pe-i386 objlist -o $@ + +#endif /* ProfiledRelocatableTarget */ + + +/* + * DebuggedRelocatableTarget - generate rules to produce a debuggable + * relocatable object file instead of a library. + */ +#ifndef DebuggedRelocatableTarget +#define DebuggedRelocatableTarget(objname,objlist) @@\ +AllTarget(Concat(objname,_d.Osuf)) @@\ + @@\ +Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ + RemoveFile($@) @@\ + $(LD) -X -r --oformat pe-i386 objlist -o $@ + +#endif /* DebuggedRelocatableTarget */ + + diff --git a/xc/config/cf/cygwin.tmpl b/xc/config/cf/cygwin.tmpl new file mode 100644 index 000000000..0b12f21b7 --- /dev/null +++ b/xc/config/cf/cygwin.tmpl @@ -0,0 +1,38 @@ +XCOMM $XConsortium: WinLib.tmpl,v 1.1 94/01/08 18:32:51 rws Exp $ +XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.1 2000/08/09 23:40:09 dawes Exp $ + +#define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) +#define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XLIBONLY) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) +#define SharedXextReqs $(LDPRELIB) $(XLIBONLY) +#define SharedXiReqs $(LDPRELIB) $(XLIB) +#define SharedPexReqs $(LDPRELIB) $(XLIBONLY) +#define SharedXtstReqs $(LDPRELIB) $(XLIB) +#define SharedXieReqs $(LDPRELIB) $(XLIBONLY) +#define SharedSMReqs $(LDPRELIB) $(ICELIB) +#define SharedXpReqs $(LDPRELIB) $(XAUTHLIB) $(EXTENSIONLIB) $(XLIBONLY) +#define SharedXvReqs $(LDPRELIB) $(XLIB) +#define SharedGLReqs $(LDPRELIB) $(XLIB) +XCOMM #define SharedXfontReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86vmReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86miscReqs $(LDPRELIB) $(XLIB) +#define SharedXpmReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86dgaReqs $(LDPRELIB) $(XLIB) +#define SharedXssReqs $(LDPRELIB) $(XLIB) $(EXTENSIONLIB) $(XTOOLLIB) +#define SharedDpsReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) +#define SharedDpsTkReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(DPSLIB) $(XLIB) +#define SharedpsresReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) + + +#ifndef FixupLibReferences +#define FixupLibReferences() @@\ +XMULIBONLY = -lXmu @@\ +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) +#endif + +#ifndef XawClientLibs +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB) $(XPMLIB) +#endif + diff --git a/xc/config/cf/gnu.cf b/xc/config/cf/gnu.cf index cfc4117aa..3e3890945 100644 --- a/xc/config/cf/gnu.cf +++ b/xc/config/cf/gnu.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.6 2000/02/29 15:24:13 tsi Exp $ +XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.7 2000/07/07 20:06:56 tsi Exp $ #ifndef OSName #define OSName GNU @@ -17,8 +17,6 @@ XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.6 2000/02/29 15:24:13 tsi Exp #endif XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) -#define HasGcc YES -#define HasGcc2 YES #define GccUsesGas YES #define UseGas YES #define GnuCpp YES @@ -50,7 +48,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #endif #define GccGasOption -DGCCUSESGAS #define DefaultGcc2i386Opt -O2 -#if HasGcc2 && defined(i386Architecture) +#if defined(HasGcc2) && defined(i386Architecture) #define OptimizedCDebugFlags DefaultGcc2i386Opt #else #define OptimizedCDebugFlags diff --git a/xc/config/cf/kdrive.cf b/xc/config/cf/kdrive.cf index 035122ca7..68417bac9 100644 --- a/xc/config/cf/kdrive.cf +++ b/xc/config/cf/kdrive.cf @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/kdrive.cf,v 1.3 2000/03/31 22:55:14 dawes Exp $ +XCOMM $XFree86: xc/config/cf/kdrive.cf,v 1.4 2000/07/07 20:06:56 tsi Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -173,13 +173,13 @@ XF86COMSRC=. #define OtherIConfigFile $(IRULESRC)/kdrive.cf #endif -#if HasGcc2 && defined(i386Architecture) +#if defined(HasGcc2) && defined(i386Architecture) #ifndef DefaultGcc2i386Opt #define DefaultGcc2i386Opt -O2 -fno-strength-reduce #endif #endif -#if HasGcc2 && defined(AlphaArchitecture) +#if defined(HasGcc2) && defined(AlphaArchitecture) #ifndef DefaultGcc2AxpOpt #define DefaultGcc2AxpOpt -O2 #endif diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index 1882ef75e..69ebca6b7 100644 --- a/xc/config/cf/linux.cf +++ b/xc/config/cf/linux.cf @@ -1,5 +1,10 @@ XCOMM platform: $TOG: linux.cf /main/47 1998/04/17 11:32:51 mgreess -XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.129 2000/06/24 17:43:44 dawes Exp $ + + + + + +XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.133 2000/08/11 17:27:10 dawes Exp $ #ifndef LinuxElfDefault #define LinuxElfDefault YES @@ -119,13 +124,11 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) LinuxAdditionalIncludes LinuxGnuSourceDefines \ LinuxLocaleDefines #define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H -#ifndef ia64Architecture #define HasPosixThreads YES #define ThreadedX YES #define HasThreadSafeAPI YES #define ThreadsLibraries -lpthread #define SystemMTDefines -D_REENTRANT -#endif /* ia64Architecture */ #ifndef HasLibCrypt #define HasLibCrypt YES #endif @@ -161,10 +164,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #ifndef XF86INT10_BUILD # ifdef i386Architecture # define XF86INT10_BUILD X86VM -# elif defined(ia64Architecture) -# define UseX86Emu NO -# define XF86INT10_BUILD XF86INT10_STUB -# elif defined(X86EMU_LIBPATH) +# else # define XF86INT10_BUILD X86EMU_GENERIC # endif #endif @@ -239,11 +239,6 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define SourceDefines LinuxSourceDefines #define BuildLibPathVar LD_LIBRARY_PATH -#define HasGcc YES -#define HasGcc2 YES -#ifndef HasGcc2ForCplusplus -# define HasGcc2ForCplusplus YES -#endif #define GccUsesGas YES #define UseGas YES #define GnuCpp YES @@ -448,6 +443,14 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* AlphaArchitecture */ +#ifdef Arm32Architecture +#define DefaultCCOptions -fsigned-char +#define OptimizedCDebugFlags -O3 +#define LinuxMachineDefines -D__arm__ -U__arm -Uarm +#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +#define ServerExtraDefines -DGCCUSEGAS XFree86ServerDefines +#endif /* Arm32Achitecture */ + #ifdef ia64Architecture #define OptimizedCDebugFlags -O2 #define LinuxMachineDefines -D__ia64__ diff --git a/xc/config/cf/lynx.cf b/xc/config/cf/lynx.cf index 3d4469df2..196b58e96 100644 --- a/xc/config/cf/lynx.cf +++ b/xc/config/cf/lynx.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.37 2000/06/20 20:07:56 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.38 2000/07/07 20:06:56 tsi Exp $ #ifndef OSName @@ -18,15 +18,13 @@ XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.37 2000/06/20 20:07:56 dawes #endif XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) - -#define HasGcc YES +#ifndef HasGcc2 +#define HasGcc2 NO +#endif #if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 2) -# define HasGcc2 YES # ifndef HasGcc2ForCplusplus # define HasGcc2ForCplusplus YES # endif -#else -# define HasGcc2 NO #endif #ifndef HasGcc2ForCplusplus # define HasGcc2ForCplusplus YES diff --git a/xc/config/cf/mach.cf b/xc/config/cf/mach.cf index 978d2de88..014b94015 100644 --- a/xc/config/cf/mach.cf +++ b/xc/config/cf/mach.cf @@ -2,7 +2,7 @@ XCOMM $TOG: mach.cf /main/2 1997/06/08 20:08:20 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/mach.cf,v 3.10 1999/03/21 01:44:59 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/mach.cf,v 3.11 2000/07/07 20:06:56 tsi Exp $ #define OSName Mach 2.5/3.0 #define OSVendor /**/ @@ -10,26 +10,16 @@ XCOMM operating system: OSName #define OSMajorVersion 1 #define OSMinorVersion 1 -#define HasGcc YES -#define HasGcc2 YES #define GccUsesGas YES #define UseGas YES #define GnuCpp YES #define UseGccMakeDepend YES -#ifndef HasGcc2ForCplusplus -#define HasGcc2ForCplusplus YES -#endif #define CcCmd gcc #define CppCmd /usr/mach3/lib/gcc-lib/i386-mach/2.3.3/cpp #define PreProcessCmd /usr/mach3/lib/gcc-lib/i386-mach/2.3.3/cpp #define DefaultCCOptions /**/ #define GccGasOption -DGCCUSESGAS -#if HasGcc2 && defined(i386Architecture) -#define OptimizedCDebugFlags DefaultGcc2i386Opt -#else -#define OptimizedCDebugFlags -O2 -#endif #define AsmDefines -DUSE_GAS #define BootstrapCFlags -DNOSTDHDRS diff --git a/xc/config/cf/nto.cf b/xc/config/cf/nto.cf index 68767336e..3969f66da 100644 --- a/xc/config/cf/nto.cf +++ b/xc/config/cf/nto.cf @@ -1,4 +1,4 @@ -/* $XFree86: xc/config/cf/nto.cf,v 1.2 1999/12/27 00:45:43 robin Exp $ */ +/* $XFree86: xc/config/cf/nto.cf,v 1.3 2000/07/07 20:06:56 tsi Exp $ */ /* Get X to build using the gcc toolchain, from QNX4 */ /* Let us try to separate the x86 stuff out of here as well... */ @@ -32,8 +32,6 @@ #define SourceDefines -D_POSIX_SOURCE #define CrossCompiling YES -#define HasGcc YES -#define HasGcc2 YES #define DoRanlibCmd YES #define GccUsesGas YES #define MkdirHierCmd mkdir -p diff --git a/xc/config/cf/os2.cf b/xc/config/cf/os2.cf index 186fb0d1d..1d8ac4ba1 100644 --- a/xc/config/cf/os2.cf +++ b/xc/config/cf/os2.cf @@ -2,7 +2,7 @@ XCOMM $TOG: os2.cf /main/2 1997/08/05 08:51:25 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.29 2000/04/05 18:13:08 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.30 2000/07/07 20:06:56 tsi Exp $ #define OSName OS/2 #define OSVendor IBM @@ -127,10 +127,7 @@ XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.29 2000/04/05 18:13:08 dawes /* * Compiler Features */ -#define HasGcc YES -#define HasGcc2 YES #define HasCplusplus YES -#define HasGcc2ForCplusplus YES #define GccUsesGas YES #define UseGas YES #define GnuCpp YES diff --git a/xc/config/cf/os2Lib.tmpl b/xc/config/cf/os2Lib.tmpl index 0153124c9..b4d6852ee 100644 --- a/xc/config/cf/os2Lib.tmpl +++ b/xc/config/cf/os2Lib.tmpl @@ -2,7 +2,7 @@ XCOMM $XConsortium: os2Lib.tmpl /main/1 1996/10/31 14:47:31 kaleb $ -XCOMM $XFree86: xc/config/cf/os2Lib.tmpl,v 3.9 2000/04/05 18:13:10 dawes Exp $ +XCOMM $XFree86: xc/config/cf/os2Lib.tmpl,v 3.10 2000/08/09 02:57:20 tsi Exp $ /* * OS2/EMX shared library template @@ -68,7 +68,6 @@ XCOMM $XFree86: xc/config/cf/os2Lib.tmpl,v 3.9 2000/04/05 18:13:10 dawes Exp $ #define SharedDpsRev /**/ #define SharedDpsTkRev /**/ #define SharedPSResRev /**/ -#define SharedXantiRev /**/ #define SharedGlxRev /**/ #define SharedXfontcacheRev /**/ #define SharedXauRev /**/ diff --git a/xc/config/cf/sun.cf b/xc/config/cf/sun.cf index 7faf7be1e..8f3f577a1 100644 --- a/xc/config/cf/sun.cf +++ b/xc/config/cf/sun.cf @@ -3,7 +3,7 @@ XCOMM platform: $TOG: sun.cf /main/176 1997/12/09 17:27:51 kaleb $ -XCOMM platform: $XFree86: xc/config/cf/sun.cf,v 3.52 2000/06/20 22:08:36 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/sun.cf,v 3.53 2000/08/11 19:51:01 dawes Exp $ #ifndef OSName # define OSName DefaultOSName @@ -157,8 +157,13 @@ XCOMM SunPro C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion #ifdef i386Architecture # if OSMajorVersion > 4 -# define ServerExtraDefines AllocateLocalDefines XFree86ServerDefines \ +# if OSMinorVersion >= 8 +# define ServerExtraDefines AllocateLocalDefines XFree86ServerDefines \ + -D__EXTENSIONS__ -D__SOL8__ +# else +# define ServerExtraDefines AllocateLocalDefines XFree86ServerDefines \ -D__EXTENSIONS__ +# endif # define ServerOSDefines XFree86ServerOSDefines # else # define ServerExtraDefines AllocateLocalDefines diff --git a/xc/config/cf/xf86.tmpl b/xc/config/cf/xf86.tmpl index 7e6c56b1d..9b113f24b 100644 --- a/xc/config/cf/xf86.tmpl +++ b/xc/config/cf/xf86.tmpl @@ -2,7 +2,14 @@ XCOMM $XConsortium: xf86.tmpl /main/2 1996/10/31 15:01:41 kaleb $ -XCOMM $XFree86: xc/config/cf/xf86.tmpl,v 3.25 1999/08/14 10:48:59 dawes Exp $ +XCOMM $XFree86: xc/config/cf/xf86.tmpl,v 3.27 2000/08/04 16:13:15 eich Exp $ + +#ifdef BuilderEMailAddr +BUILDERADDR = BuilderEMailAddr +#else +BUILDERADDR = "xfree86@xfree86.org" +#endif +BUGMSG = -DBUILDERADDR='$(BUILDERADDR)' #if XF86DriverSDK BUILDMODULEDIR = $(DRIVERSDKMODULEDIR) @@ -38,8 +45,12 @@ XCOMM $XFree86: xc/config/cf/xf86.tmpl,v 3.25 1999/08/14 10:48:59 dawes Exp $ #if defined(IHaveModules) && MakeDllModules MODULE_CFLAGS = $(PICFLAGS) #endif -#if defined(IHaveModules) && DoLoadableServer -MODULE_DEFINES = -DIN_MODULE +#if defined(IHaveModules) +# if DoLoadableServer +MODULE_DEFINES = -DIN_MODULE -DXFree86Module +# else +MODULE_DEFINES = -DXFree86Module +# endif #endif #if defined(IHaveModules) && DoLoadableServer && defined(OS2Architecture) diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf index 2e5b32c53..da51a798f 100644 --- a/xc/config/cf/xfree86.cf +++ b/xc/config/cf/xfree86.cf @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.300 2000/06/30 19:30:15 dawes Exp $ +XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.308 2000/08/11 19:10:36 dawes Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -13,7 +13,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ */ #ifndef XFree86Devel -# define XFree86Devel NO +# define XFree86Devel YES #endif /* @@ -34,11 +34,13 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ /* XInput drivers */ #ifndef XInputDrivers #if 1 -#define XInputDrivers mouse dynapro elographics microtouch mutouch \ +#define XInputDrivers mouse digitaledge dynapro elographics \ + microtouch mutouch spaceorb summa \ wacom void #else -#define XInputDrivers mouse dynapro elo2300 elographics magellan \ - microtouch mutouch spaceorb wacom void +#define XInputDrivers mouse digitaledge dynapro elo2300 \ + elographics magellan \ + microtouch mutouch spaceorb summa wacom void #endif #endif @@ -65,10 +67,10 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ #endif /* - * For Intel x86 platforms, the default is to build all modules which + * For Intel platforms, the default is to build all modules which * are supported on this platform. */ -#ifdef i386Architecture +#if defined(i386Architecture) || defined(ia64Architecture) # ifndef XF86Server # define XF86Server YES # endif @@ -163,91 +165,11 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ neomagic i740 tdfx \ cirrus tseng trident chips apm \ GlideDriver fbdev \ - ati r128 AgpGartDrivers DevelDrivers cyrix \ + r128 ati AgpGartDrivers DevelDrivers cyrix \ vga XF86OSCardDrivers XF86ExtraCardDrivers # endif #endif -/* IA-64 */ - -#ifdef ia64Architecture -# ifndef XF86Server -# define XF86Server YES -# endif -/* 1bpp module */ -# ifndef XF1Bpp -# define XF1Bpp YES -# endif -/* 4bpp module */ -# ifndef XF4Bpp -# define XF4Bpp YES -# endif -/* 8/32bpp overlay module */ -# ifndef XF8_32Bpp -# define XF8_32Bpp YES -# endif -/* 8/16bpp dual fb module */ -# ifndef XF8_16Bpp -# define XF8_16Bpp YES -# endif -/* 24/32bpp conversion module */ -# ifndef XF24_32Bpp -# define XF24_32Bpp YES -# endif -/* shadow fb module */ -# ifndef XFShadowFB -# define XFShadowFB YES -# endif -/* vgahw module */ -# ifndef XF86VgaHw -# define XF86VgaHw YES -# endif -/* fbdevhw module */ -# ifndef XF86FBDevHw -# define XF86FBDevHw YES -# endif -/* XAA module */ -# ifndef XF86XAA -# define XF86XAA YES -# endif -/* ramdac module */ -# ifndef XF86Ramdac -# define XF86Ramdac YES -# endif -/* I2C module */ -# ifndef XF86I2C -# define XF86I2C YES -# endif -/* DDC module */ -# ifndef XF86DDC -# define XF86DDC YES -# endif -/* RAC (Resource Access Control) module */ -# ifndef XF86RAC -# define XF86RAC YES -# endif - -/* int10 module */ -# ifndef XF86Int10 -# define XF86Int10 YES -# endif - -/* - * XXX Should change this to allow such drivers to be built without agpgart - * support (when it is useful to do so). - */ -# if HasAgpGart -# define AgpGartDrivers i810 -# else -# define AgpGartDrivers /**/ -# endif - -/* Pure PCI drivers should go first */ -# ifndef XF86CardDrivers -# define XF86CardDrivers mga vga -# endif -#endif - /* Sparc drivers */ #if defined(SparcArchitecture) && !defined(LynxOSArchitecture) && !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) && !defined(SunArchitecture) @@ -306,6 +228,10 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # ifndef XF86RAC # define XF86RAC YES # endif +/* int10 module */ +# ifndef XF86Int10 +# define XF86Int10 YES +# endif /* Pure SBUS and PCI drivers should go first */ # ifndef XF86CardDrivers @@ -358,7 +284,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # endif /* 1bpp module */ # ifndef XF1Bpp -# define XF1Bpp NO +# define XF1Bpp YES # endif /* 4bpp module */ # ifndef XF4Bpp @@ -414,10 +340,19 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # define XF86Int10 YES # endif +# ifndef DevelDrivers +# if XFree86Devel +# define DevelDrivers ati +# else +# define DevelDrivers /* */ +# endif +# endif + /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers # define XF86CardDrivers mga tdfx glint s3virge rendition tga \ - r128 vga XF86OSCardDrivers XF86ExtraCardDrivers + r128 DevelDrivers vga \ + XF86OSCardDrivers XF86ExtraCardDrivers # endif #endif @@ -490,11 +425,20 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ # define XF86Int10 YES # endif +# ifndef DevelDrivers +# if XFree86Devel +# define DevelDrivers ati +# else +# define DevelDrivers /* */ +# endif +# endif + /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers # define XF86CardDrivers r128 mga glint s3virge sis cirrus tseng \ trident chips fbdev \ - vga XF86OSCardDrivers XF86ExtraCardDrivers + DevelDrivers vga \ + XF86OSCardDrivers XF86ExtraCardDrivers # endif #endif @@ -503,9 +447,9 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ * For Mips/Arc platforms, the default is to build all modules which * are supported on this platform. */ -# ifdef ArcArchitecture -# ifndef XF86Server -# define XF86Server YES +#ifdef ArcArchitecture +# ifndef XF86Server +# define XF86Server YES # endif #endif @@ -563,7 +507,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 * The server-side of PEX is not 64-bit clean. */ #if !defined(BuildPexExt) -# if XF86Server && !defined(AlphaArchitecture) +# if XF86Server && !defined(AlphaArchitecture) && !defined(ia64Architecture) # define BuildPexExt YES # else # define BuildPexExt NO @@ -615,7 +559,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define GlxDriverUsesMesa YES # endif -# if GlxBuiltInGamma || GlxBuiltInTdfx || GlxBuiltInMga || GlxBuiltInI810 || GlxBuiltInR128 || GlxBuiltInFfb || GlxBuiltInMesa +# if GlxBuiltInGamma || GlxBuiltInTdfx || GlxBuiltInMga || GlxBuiltInI810 || GlxBuiltInR128 || GlxBuiltInFfb || GlxBuiltInSIS || GlxBuiltInMesa # define GlxUseBuiltInDRIDriver YES # define DRIDynLoadDefines /**/ # else @@ -658,7 +602,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define GlxCoreLibDefines /**/ # endif -# if defined(SparcArchitecture) || defined(AlphaArchitecture) +# if defined(SparcArchitecture) # define GlxArchDefines -D__GLX_ALIGN64 # else # define GlxArchDefines /**/ @@ -770,9 +714,6 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #ifndef BuildXvLibrary # define BuildXvLibrary YES #endif -#ifndef BuildXantiLibrary -# define BuildXantiLibrary NO /* See the note for BuildXantiExt */ -#endif #ifndef BuildGLXLibrary # define BuildGLXLibrary YES #endif @@ -843,15 +784,6 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define BuildXvExt YES #endif -/* - * Build the Antialiased Font Extension (this has been abandoned, at least - * temporarily) - */ -#ifndef BuildXantiExt -# define BuildXantiExt NO -#endif - - #if Malloc0ReturnsNull # ifndef XtMalloc0ReturnsNullDefines diff --git a/xc/config/imake/Makefile.ini b/xc/config/imake/Makefile.ini index 653417db1..44c62a132 100644 --- a/xc/config/imake/Makefile.ini +++ b/xc/config/imake/Makefile.ini @@ -7,7 +7,7 @@ # may be given at the top of the build tree for systems that do not define # any machine-specific preprocessor symbols. # -# $XFree86: xc/config/imake/Makefile.ini,v 3.5 1997/06/11 12:24:21 dawes Exp $ +# $XFree86: xc/config/imake/Makefile.ini,v 3.6 2000/08/09 23:40:09 dawes Exp $ BOOTSTRAPCFLAGS = CC = cc @@ -39,7 +39,9 @@ ccimake: ccimake.c bootstrap: -@if [ -d bootstrap ]; then exit 0; else set -x; mkdir bootstrap; fi - $(MV) *.o imake bootstrap + $(MV) *.o bootstrap + if [ -f imake ]; then $(MV) imake bootstrap; fi + if [ -f imake.exe ]; then $(MV) imake.exe bootstrap; fi relink: $(RM) imake diff --git a/xc/config/imake/imake.c b/xc/config/imake/imake.c index e706a29f7..cf88d29e0 100644 --- a/xc/config/imake/imake.c +++ b/xc/config/imake/imake.c @@ -8,7 +8,7 @@ * be passed to the template file. * * * ***************************************************************************/ -/* $XFree86: xc/config/imake/imake.c,v 3.35 2000/06/13 02:28:27 dawes Exp $ */ +/* $XFree86: xc/config/imake/imake.c,v 3.36 2000/07/07 20:06:57 tsi Exp $ */ /* * @@ -1133,6 +1133,19 @@ get_sun_compiler_versions (FILE *inFile) } #endif +#ifdef __GNUC__ +static void +get_gcc_version(FILE *inFile) +{ + fprintf (inFile, "#define HasGcc 1\n"); +#if __GNUC__ > 1 + fprintf (inFile, "#define HasGcc2 1\n"); +#endif + fprintf (inFile, "#define GccMajorVersion %d\n", __GNUC__); + fprintf (inFile, "#define GccMinorVersion %d\n", __GNUC_MINOR__); +} +#endif + #ifndef __EMX__ static void get_gcc_incdir(FILE *inFile) @@ -1238,6 +1251,9 @@ define_os_defaults(FILE *inFile) #if defined (sun) && defined(SVR4) get_sun_compiler_versions (inFile); #endif +#ifdef __GNUC__ + get_gcc_version (inFile); +#endif #ifdef __FreeBSD__ get_binary_format(inFile); #endif diff --git a/xc/config/imake/imakemdep.h b/xc/config/imake/imakemdep.h index 85383a528..1cfe347a9 100644 --- a/xc/config/imake/imakemdep.h +++ b/xc/config/imake/imakemdep.h @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/config/imake/imakemdep.h,v 3.39 2000/06/15 20:49:57 dawes Exp $ */ +/* $XFree86: xc/config/imake/imakemdep.h,v 3.41 2000/08/11 17:27:10 dawes Exp $ */ /* @@ -296,6 +296,10 @@ in this Software without prior written authorization from The Open Group. /* expects cpp in PATH */ #define DEFAULT_CPP "cpp" #endif +#ifdef __CYGWIN__ +#define USE_CC_E +#define DEFAULT_CC "gcc" +#endif #if defined(__GNU__) #define USE_CC_E #endif @@ -335,6 +339,9 @@ char *cpp_argv[ARGUMENTS] = { # ifdef __alpha__ "-D__alpha__", # endif +#ifdef __arm__ + "-D__arm__", +#endif # ifdef __sparc__ "-D__sparc__", # endif @@ -537,6 +544,9 @@ char *cpp_argv[ARGUMENTS] = { #ifdef linux "-Dlinux", #endif +#if defined(__CYGWIN__) + "-traditional", +#endif #if defined(Lynx) || defined(__Lynx__) "-traditional", #if 0 diff --git a/xc/config/util/gccmdep.cpp b/xc/config/util/gccmdep.cpp index d8c25adfd..603c5f933 100644 --- a/xc/config/util/gccmdep.cpp +++ b/xc/config/util/gccmdep.cpp @@ -3,12 +3,12 @@ XCOMM!/bin/sh XCOMM XCOMM makedepend which uses 'gcc -M' XCOMM -XCOMM $XFree86: xc/config/util/gccmdep.cpp,v 3.3 1996/02/25 01:16:15 dawes Exp $ +XCOMM $XFree86: xc/config/util/gccmdep.cpp,v 3.4 2000/08/08 03:16:26 dawes Exp $ XCOMM XCOMM Based on mdepend.cpp and code supplied by Hongjiu Lu <hjl@nynexst.com> XCOMM -TMP=/tmp/mdep$$ +TMP=`pwd`/.mdep$$ CC=CCCMD RM=RMCMD LN=LNCMD diff --git a/xc/config/util/mdepend.cpp b/xc/config/util/mdepend.cpp index 2db70ebde..b54ef3a19 100644 --- a/xc/config/util/mdepend.cpp +++ b/xc/config/util/mdepend.cpp @@ -22,14 +22,14 @@ XCOMM work on both USG and BSD systems. However, when System V.4 comes out, XCOMM USG users will probably have to change "silent" to "-s" instead of XCOMM "-" (at least, that is what the documentation implies). XCOMM -XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.2 1997/06/29 07:54:20 dawes Exp $ +XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.3 2000/08/08 03:16:26 dawes Exp $ XCOMM CC=PREPROC silent='-' -TMP=/tmp/mdep$$ +TMP=`pwd`/.mdep$$ CPPCMD=${TMP}a DEPENDLINES=${TMP}b TMPMAKEFILE=${TMP}c diff --git a/xc/doc/specs/GL/Imakefile b/xc/doc/specs/GL/Imakefile new file mode 100644 index 000000000..f112c4d1e --- /dev/null +++ b/xc/doc/specs/GL/Imakefile @@ -0,0 +1,4 @@ +XCOMM $XFree86: xc/doc/specs/GL/Imakefile,v 1.1 2000/03/02 17:52:57 dawes Exp $ + +InstallDoc(libGL,libGL.txt) + diff --git a/xc/doc/specs/GL/libGL.txt b/xc/doc/specs/GL/libGL.txt new file mode 100644 index 000000000..cb9884043 --- /dev/null +++ b/xc/doc/specs/GL/libGL.txt @@ -0,0 +1,197 @@ + + + +Introduction +------------ + +This document describes the implementation of the XFree86 4.0 libGL.so +library defined by the Linux/OpenGL Base specification found at +http://reality.sgi.com/opengl/linux/linuxbase.html. + +The documentation is divided into two sections: + User's Guide + Driver Developer's Guide + +Author: Brian Paul (brian@precisioninsight.com) +Date: February 2000 + + + +User's Guide +------------ + +Using libGL.so + +The libGL.so library defines the gl- and glX-prefixed functions needed to +run OpenGL programs. OpenGL client applications should link with the +-lGL option to use it. + +libGL.so serves two primary functions: GLX protocol generation for indirect +rendering and loading/management of hardware drivers for direct rendering. + +When libGL.so initializes itself it uses the DRI to determine the +appropriate hardware driver for each screen on the local X display. +The hardware drivers are expected to be in the /usr/X11R6/lib/modules/dri/ +directory. Drivers are named with the convention <name>_dri.so where +<name> is a driver such as "tdfx", "i810", "gamma", etc. + +The LIBGL_DRIVERS_DIR environment variable may be used to specify a +different DRI modules directory, overriding /usr/X11R6/lib/modules/dri/. +This environment variable is ignored in setuid programs for security +reasons. + +When libGL.so is unable to locate appropriate hardware drivers it will +fall back to using indirect GLX rendering. + +To aid in solving problems, libGL.so will print diagnostic messages to +stderr if the LIBGL_DEBUG environment variable is defined. + +libGL.so is thread safe. The overhead of thread safety for common, +single-thread clients is negligible. However, the overhead of thread +safety for multi-threaded clients is significant. Each GL API call +requires two calls to pthread_get_specific() which can noticably +impact performance. Warning: libGL.so is thread safe but individual +DRI drivers may not be. Please consult the documentation for a driver +to learn if it is thread safe. + + + +Indirect Rendering + +You can force indirect rendering mode by setting the LIBGL_ALWAYS_INDIRECT +environment variable. Hardware acceleration will not be used. + + + +libGL.so Extensibility + +libGL.so is designed to be extended without upgrading. That is, +drivers may install new OpenGL extension functions into libGL.so +without requiring libGL.so to be replaced. Clients of libGL.so should +use the glXGetProcAddressEXT() function to obtain the address of +functions by name. For more details of GLX_ARB_get_proc_address see +http://oss.sgi.com/projects/ogl-sample/registry/ARB/get_proc_address.spec + +libGL.so is also designed with flexibility such that it may be used +with many generations of hardware drivers to come. + + + + +Driver Developer's Guide +------------------------ + +This section describes the requirements to make an XFree86 4.0 +libGL.so-compatible hardware driver. It is not intended for end +users of libGL.so. + + +XFree86 source files + +libGL.so is built inside XFree86 with sources found in xc/lib/GL/. +Specifically, libGL.so is built from: + + xc/lib/GL/glx/*.c + xc/lib/dri/XF86dri.c + xc/lib/dri/dri_glx.c + xc/lib/GL/mesa/src/glapi.c + xc/lib/GL/mesa/src/glapitemp.h + xc/lib/GL/mesa/src/glapitable.h + xc/lib/GL/mesa/src/glapioffsets.h + xc/lib/GL/mesa/src/glapinoop.c + xc/lib/GL/mesa/src/glheader.h + xc/lib/GL/mesa/src/glthread.c + xc/lib/GL/mesa/src/glthread.h + xc/lib/GL/mesa/src/X86/glapi_x86.S + xc/lib/GL/mesa/src/X86/assyntax.h + +Understand that the mesa/src/gl*.[ch] files are not tied to Mesa. They +have no dependencies on the rest of Mesa and are designed to be reusable +in a number of projects. + +The glapi_x86.X and assyntax.h files implement x86-optimized dispatch +of GL functions. They are not required; C-based dispatch can be used +instead, with a slight performance penalty. + + + +Driver loading and binding + +When libGL.so initializes itself (via the __glXInitialize function) a +call is made to driCreateDisplay(). This function uses DRI facilities +to determine the driver file appropriate for each screen on the local +display. Each screen's driver is then opened with dlopen() and asked +for its __driCreateScreen() function. The pointers to the __driCreateScreen() +functions are kept in an array, indexed by screen number, in the +__DRIdisplayRec struct. + +When a driver's __driCreateScreen() function is called, it must initialize +a __DRIscreenRec struct. This struct acts as the root of a tree of +function pointers which are called to create and destroy contexts and +drawables and perform all the operations needed by the GLX interface. +See the xc/lib/GL/glx/glxclient.h file for details. + + + +Dynamic Extension Function Registration + +In order to provide forward compatibility with future drivers, libGL.so +allows drivers to register new OpenGL extension functions which weren't +known when libGL.so was built. + +The register_extensions() function in xc/lib/GL/dri/dri_glx.c is called +as soon as libGL.so is loaded. This is done with gcc's constructor +attribute. This mechanism will likely have to be changed for other compilers. + +register_extensions() loops over all local displays and screens, determines +the DRI driver for each, and calls the driver's __driRegisterExtensions() +function, if present. + +The __driRegisterExtensions() function can add new entrypoints to libGL +by calling: + + GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset) + +The parameters are the name of the function (such as "glFoobarEXT") and the +offset of the dispatch slot in the API dispatch table. The return value +indicates success (GL_TRUE) or failure (GL_FALSE). + +_glapi_add_entrypoint() will synthesize entrypoint code in assembly +language. Assembly languages is required since parameter passing +can't be handled correctly using a C-based solution. + +The address of the new entrypoint is obtained by calling the +glXGetProcAddressARB() function. + +The dispatch offset number MUST be a number allocated by SGI in the same +manner in which new GL_* constants are allocated. Using an arbitrary +offset number will result in many problems. + + + +Dispatch Management + +When a GL context is made current, the driver must install its dispatch +table as the current dispatch table. This is done by calling + + void _glapi_set_dispatch(struct _glapi_table *dispatch); + +This will install the named dispatch table for the calling thread. +The current dispatch table for a thread can be obtained by calling + + struct _glapi_table *_glapi_get_dispatch(void); + +For higher performance in the common single-thread case, the global +variable _glapi_Dispatch will point to the current dispatch table. +This variable will be NULL when in multi-thread mode. + + + +Context Management + +libGL.so uses the XFree86 xthreads package to manage a thread-specific +current context pointer. See __glXGet/SetCurrentContext() in glext.c + +Drivers may use the _glapi_set/get_context() functions to maintain +a private thread-specific context pointer. + diff --git a/xc/doc/specs/Imakefile b/xc/doc/specs/Imakefile index c2e145b5e..8974475ce 100644 --- a/xc/doc/specs/Imakefile +++ b/xc/doc/specs/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile,v 1.10 94/07/25 12:21:20 gildea Exp $ -XCOMM $XFree86: xc/doc/specs/Imakefile,v 1.2 1998/12/20 11:56:38 dawes Exp $ +XCOMM $XFree86: xc/doc/specs/Imakefile,v 1.3 2000/03/02 17:52:57 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags @@ -9,7 +9,7 @@ SUBDIRS = SpecsDocDirs #else SUBDIRS = BDF CTEXT FSProtocol ICCCM XProtocol Xserver X11 XDMCP XLFD \ Xaw Xmu Xt Xext Xi xfs PEX5 ICE SM xtrans XIM xterm rstart \ - i18n programs + GL Xv i18n programs #endif all:: diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index f7d1224cf..7266dbc29 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -22,6 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/extras/Mesa/include/GL/gl.h,v 1.6 2000/08/11 16:36:41 dawes Exp $ */ #ifndef __gl_h_ @@ -43,11 +44,11 @@ #define OPENSTEP #endif -#if defined(_WIN32) && !defined(__WIN32__) +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) #define __WIN32__ #endif -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) # if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define GLAPI __declspec(dllexport) # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ @@ -62,7 +63,7 @@ # define GLAPIENTRY #endif /* WIN32 / CYGWIN bracket */ -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(__CYGWIN__) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) #include <gl/mesa_wgl.h> #endif diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index 20ad79b81..7261194bd 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -22,6 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/extras/Mesa/src/X/xmesa1.c,v 1.6 2000/08/09 23:40:10 dawes Exp $ */ /* @@ -59,6 +60,10 @@ * */ +#ifdef __CYGWIN__ +#undef WIN32 +#undef __WIN32__ +#endif #include "glxheader.h" #include "GL/xmesa.h" diff --git a/xc/extras/Mesa/src/config.c b/xc/extras/Mesa/src/config.c index 575ec7219..8f8a79aae 100644 --- a/xc/extras/Mesa/src/config.c +++ b/xc/extras/Mesa/src/config.c @@ -22,6 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/extras/Mesa/src/config.c,v 1.5 2000/08/09 23:40:10 dawes Exp $ */ /* Mesa config file parse and execute code. @@ -403,7 +404,7 @@ void gl_read_config_file( GLcontext *ctx ) { const char *default_config = "mesa3.1beta1"; -#if defined(__WIN32__) || defined(__MSDOS__) +#if (defined(__WIN32__) && !defined(__CYGWIN__)) || defined(__MSDOS__) const char *filename = "mesa.cnf"; #else const char *filename = "/etc/mesa.conf"; diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index e34ec9cfb..8276f518a 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -22,6 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* $XFree86: xc/extras/Mesa/src/glheader.h,v 1.8 2000/08/11 17:01:49 dawes Exp $ */ #ifndef GLHEADER_H @@ -77,11 +78,11 @@ * the new src/glheader.h file. */ -#if defined(_WIN32) && !defined(__WIN32__) +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) # define __WIN32__ #endif -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) # pragma warning( disable : 4068 ) /* unknown pragma */ # pragma warning( disable : 4710 ) /* function 'foo' not inlined */ # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ @@ -128,7 +129,7 @@ /* compatability guard so we don't need to change client code */ -#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) +#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) #if 0 # define CALLBACK GLCALLBACK #endif @@ -138,7 +139,7 @@ typedef void *HDC; typedef unsigned long COLORREF; #endif -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) # define WGL_FONT_LINES 0 # define WGL_FONT_POLYGONS 1 #ifndef _GNU_H_WINDOWS32_FUNCTIONS diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index 28d90bb6d..773e77645 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -22,7 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.5 2000/06/17 00:02:14 martin Exp $ */ +/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.6 2000/08/09 23:40:10 dawes Exp $ */ /* * Faster arithmetic functions. If the FAST_MATH preprocessor symbol is @@ -158,7 +158,7 @@ static __inline__ int FloatToInt(float f) __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); return r; } -#elif defined(__MSC__) && defined(__WIN32__) +#elif defined(__MSC__) && defined(__WIN32__) && !defined(__CYGWIN__) static __inline int FloatToInt(float f) { int r; diff --git a/xc/extras/rman/rman.c b/xc/extras/rman/rman.c index 1e20cc254..b82f43872 100644 --- a/xc/extras/rman/rman.c +++ b/xc/extras/rman/rman.c @@ -16,7 +16,7 @@ static char rcsid[] = "Header: /home/cs/phelps/spine/rman/RCS/rman.c,v 1.144 199 source interpretation added September 24, 1996 renamed PolyglotMan due to lawsuit by Rosetta, Inc. August 8, 1997 */ -/* $XFree86: xc/extras/rman/rman.c,v 1.9 2000/06/13 23:15:47 dawes Exp $ */ +/* $XFree86: xc/extras/rman/rman.c,v 1.11 2000/08/09 23:40:11 dawes Exp $ */ /* TO DO **** @@ -58,6 +58,9 @@ static char rcsid[] = "Header: /home/cs/phelps/spine/rman/RCS/rman.c,v 1.144 199 extern int optind; extern char *optarg; #endif +#ifdef __CYGWIN__ +#include <getopt.h> +#endif /*** make #define's into consts? => can't because compilers not smart enough ***/ /* maximum number of tags per line */ @@ -1606,7 +1609,7 @@ HTML(enum command cmd) case BEGINCOMMENT: printf("\n<!--\n"); break; case ENDCOMMENT: printf("\n-->\n"); break; - case COMMENTLINE: break; + case COMMENTLINE: printf(" "); break; case BEGINSECTHEAD: printf("\n<H2><A NAME=\"sect%d\" HREF=\"#toc%d\">", tocc, tocc); diff --git a/xc/include/GL/Imakefile b/xc/include/GL/Imakefile index 7b9e9dbc0..750b4953f 100644 --- a/xc/include/GL/Imakefile +++ b/xc/include/GL/Imakefile @@ -1,12 +1,12 @@ -XCOMM $XFree86: xc/include/GL/Imakefile,v 1.9 2000/06/17 00:02:46 martin Exp $ +XCOMM $XFree86: xc/include/GL/Imakefile,v 1.10 2000/08/04 03:51:40 tsi Exp $ LinkSourceFile(gl.h, ../../extras/Mesa/include/GL) LinkSourceFile(glext.h, ../../extras/Mesa/include/GL) LinkSourceFile(osmesa.h, ../../extras/Mesa/include/GL) #if BuildGLXLibrary -GLXHEADERS = gl.h glext.h glx.h glxtokens.h osmesa.h +GLXHEADERS = gl.h glext.h glx.h glxint.h glxtokens.h osmesa.h #endif HEADERS = $(GLXHEADERS) diff --git a/xc/include/Imakefile b/xc/include/Imakefile index 20068e14b..98899f60f 100644 --- a/xc/include/Imakefile +++ b/xc/include/Imakefile @@ -3,7 +3,7 @@ XCOMM $TOG: Imakefile /main/93 1997/06/13 15:34:58 kaleb $ -XCOMM $XFree86: xc/include/Imakefile,v 3.24 2000/06/30 21:51:51 dawes Exp $ +XCOMM $XFree86: xc/include/Imakefile,v 3.25 2000/07/02 19:23:34 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags /**/ @@ -73,8 +73,9 @@ InstallDriverSDKNonExecFile(Xprotostr.h,$(DRIVERSDKINCLUDEDIR)) XCOMM For the Linux/OpenGL base standard #if LinkGLToUsrInclude && AlternateIncRoot install:: -/* -$(RM) $(SYSTEMUSRINCDIR)/GL */ - @if [ ! -d $(SYSTEMUSRINCDIR)/GL ]; then \ - set -x; $(LN) $(INCDIR)/GL $(SYSTEMUSRINCDIR)/GL; \ + MakeDir($(DESTDIR)$(SYSTEMUSRINCDIR)) + -$(RM) $(DESTDIR)$(SYSTEMUSRINCDIR)/GL + @if [ ! -d $(DESTDIR)$(SYSTEMUSRINCDIR)/GL ]; then \ + set -x; $(LN) $(INCDIR)/GL $(DESTDIR)$(SYSTEMUSRINCDIR)/GL; \ fi #endif diff --git a/xc/include/XF86keysym.h b/xc/include/XF86keysym.h index 658bbae01..9b6773641 100644 --- a/xc/include/XF86keysym.h +++ b/xc/include/XF86keysym.h @@ -1,12 +1,30 @@ -/* $XFree86: xc/include/XF86keysym.h,v 1.4 2000/06/17 00:27:29 dawes Exp $ */ +/* $XFree86: xc/include/XF86keysym.h,v 1.5 2000/07/07 00:44:58 dawes Exp $ */ /* - * ModeLock (not needed since XKB offers this functionality) + * XFree86 vendor specific keysyms. + * + * The XFree86 keysym range is 0x1008FF01 - 0x1008FFFF. + * + * When adding new entries, the xc/lib/XKeysymDB file should also be + * updated to make the new entries visible to Xlib. + */ + +/* + * ModeLock + * + * This one is old, and not really used any more since XKB offers this + * functionality. */ #define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ /* + * Note, 0x1008FF02 - 0x1008FF0F are free and should be used for misc new + * keysyms that don't fit into any of the groups below. + */ + + +/* * Keys found on some "Internet" keyboards. */ #define XF86XK_Standby 0x1008FF10 @@ -39,6 +57,10 @@ #define XF86XK_Forward 0x1008FF27 #define XF86XK_Stop 0x1008FF28 #define XF86XK_Refresh 0x1008FF29 + +/* Note, 0x1008FF2A - 0x1008FF2F are free and should be used next */ + +/* Some more ... */ #define XF86XK_Favorites 0x1008FF30 #define XF86XK_AudioPause 0x1008FF31 #define XF86XK_AudioMedia 0x1008FF32 diff --git a/xc/include/Xmd.h b/xc/include/Xmd.h index 0df56e05d..b019e876f 100644 --- a/xc/include/Xmd.h +++ b/xc/include/Xmd.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/Xmd.h,v 3.6 2000/02/22 00:59:40 mvojkovi Exp $ */ +/* $XFree86: xc/include/Xmd.h,v 3.7 2000/08/09 23:40:11 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -145,6 +145,7 @@ typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; +#ifndef __CYGWIN__ #ifndef __EMX__ typedef CARD8 BYTE; typedef CARD8 BOOL; @@ -156,7 +157,14 @@ typedef CARD8 BOOL; #define BYTE CARD8 #define BOOL CARD8 #endif +#endif +#ifdef __CYGWIN__ +#undef BYTE +#undef BOOL +#define BYTE CARD8 +#define BOOL CARD8 +#endif /* * definitions for sign-extending bitfields on 64-bit architectures diff --git a/xc/include/Xos.h b/xc/include/Xos.h index c4582724f..30ce3d56f 100644 --- a/xc/include/Xos.h +++ b/xc/include/Xos.h @@ -23,7 +23,7 @@ in this Software without prior written authorization from The Open Group. * The X Window System is a Trademark of The Open Group. * */ -/* $XFree86: xc/include/Xos.h,v 3.28 2000/04/05 18:13:15 dawes Exp $ */ +/* $XFree86: xc/include/Xos.h,v 3.30 2000/08/10 17:40:27 dawes Exp $ */ /* This is a collection of things to try and minimize system dependencies * in a "signficant" number of source files. @@ -121,7 +121,7 @@ extern int sys_nerr; /* * Get open(2) constants */ -#ifdef X_NOT_POSIX +#if defined(X_NOT_POSIX) && !defined(__CYGWIN__) #include <fcntl.h> #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__) #include <unistd.h> @@ -291,7 +291,7 @@ typedef unsigned long fd_mask; #define NGROUPS 16 #endif -#if defined(ISC) || (defined(__QNX__) && !defined(UNIXCONN)) +#if defined(ISC) || (defined(__QNX__) && !defined(UNIXCONN)) || defined(__CYGWIN__) /* * Some OS's may not have this */ diff --git a/xc/lib/GL/GL-def.cpp b/xc/lib/GL/GL-def.cpp new file mode 100644 index 000000000..bb08a81ef --- /dev/null +++ b/xc/lib/GL/GL-def.cpp @@ -0,0 +1,431 @@ +LIBRARY libGL +VERSION LIBRARY_VERSION +EXPORTS + glClearIndex @ 1 + glClearColor @ 2 + glClear @ 3 + glIndexMask @ 4 + glColorMask @ 5 + glAlphaFunc @ 6 + glBlendFunc @ 7 + glLogicOp @ 8 + glCullFace @ 9 + glFrontFace @ 10 + glPointSize @ 11 + glLineWidth @ 12 + glLineStipple @ 13 + glPolygonMode @ 14 + glPolygonStipple @ 15 + glGetPolygonStipple @ 16 + glEdgeFlag @ 17 + glEdgeFlagv @ 18 + glScissor @ 19 + glClipPlane @ 20 + glGetClipPlane @ 21 + glDrawBuffer @ 22 + glReadBuffer @ 23 + glEnable @ 24 + glDisable @ 25 + glIsEnabled @ 26 + glGetBooleanv @ 27 + glGetDoublev @ 28 + glGetFloatv @ 29 + glGetIntegerv @ 30 + glPushAttrib @ 31 + glPopAttrib @ 32 + glRenderMode @ 33 + glGetError @ 34 + glGetString @ 35 + glFinish @ 36 + glFlush @ 37 + glHint @ 38 + glClearDepth @ 39 + glDepthFunc @ 40 + glDepthMask @ 41 + glDepthRange @ 42 + glClearAccum @ 43 + glAccum @ 44 + glMatrixMode @ 45 + glOrtho @ 46 + glFrustum @ 47 + glViewport @ 48 + glPushMatrix @ 49 + glPopMatrix @ 50 + glLoadIdentity @ 51 + glLoadMatrixd @ 52 + glLoadMatrixf @ 53 + glMultMatrixd @ 54 + glMultMatrixf @ 55 + glRotated @ 56 + glRotatef @ 57 + glScaled @ 58 + glScalef @ 59 + glTranslated @ 60 + glTranslatef @ 61 + glIsList @ 62 + glDeleteLists @ 63 + glGenLists @ 64 + glNewList @ 65 + glEndList @ 66 + glCallList @ 67 + glCallLists @ 68 + glListBase @ 69 + glBegin @ 70 + glEnd @ 71 + glVertex2d @ 72 + glVertex2f @ 73 + glVertex2i @ 74 + glVertex2s @ 75 + glVertex3d @ 76 + glVertex3f @ 77 + glVertex3i @ 78 + glVertex3s @ 79 + glVertex4d @ 80 + glVertex4f @ 81 + glVertex4i @ 82 + glVertex4s @ 83 + glVertex2dv @ 84 + glVertex2fv @ 85 + glVertex2iv @ 86 + glVertex2sv @ 87 + glVertex3dv @ 88 + glVertex3fv @ 89 + glVertex3iv @ 90 + glVertex3sv @ 91 + glVertex4dv @ 92 + glVertex4fv @ 93 + glVertex4iv @ 94 + glVertex4sv @ 95 + glNormal3b @ 96 + glNormal3d @ 97 + glNormal3f @ 98 + glNormal3i @ 99 + glNormal3s @ 100 + glNormal3bv @ 101 + glNormal3dv @ 102 + glNormal3fv @ 103 + glNormal3iv @ 104 + glNormal3sv @ 105 + glIndexd @ 106 + glIndexf @ 107 + glIndexi @ 108 + glIndexs @ 109 + glIndexdv @ 110 + glIndexfv @ 111 + glIndexiv @ 112 + glIndexsv @ 113 + glColor3b @ 114 + glColor3d @ 115 + glColor3f @ 116 + glColor3i @ 117 + glColor3s @ 118 + glColor3ub @ 119 + glColor3ui @ 120 + glColor3us @ 121 + glColor4b @ 122 + glColor4d @ 123 + glColor4f @ 124 + glColor4i @ 125 + glColor4s @ 126 + glColor4ub @ 127 + glColor4ui @ 128 + glColor4us @ 129 + glColor3bv @ 130 + glColor3dv @ 131 + glColor3fv @ 132 + glColor3iv @ 133 + glColor3sv @ 134 + glColor3ubv @ 135 + glColor3uiv @ 136 + glColor3usv @ 137 + glColor4bv @ 138 + glColor4dv @ 139 + glColor4fv @ 140 + glColor4iv @ 141 + glColor4sv @ 142 + glColor4ubv @ 143 + glColor4uiv @ 144 + glColor4usv @ 145 + glTexCoord1d @ 146 + glTexCoord1f @ 147 + glTexCoord1i @ 148 + glTexCoord1s @ 149 + glTexCoord2d @ 150 + glTexCoord2f @ 151 + glTexCoord2i @ 152 + glTexCoord2s @ 153 + glTexCoord3d @ 154 + glTexCoord3f @ 155 + glTexCoord3i @ 156 + glTexCoord3s @ 157 + glTexCoord4d @ 158 + glTexCoord4f @ 159 + glTexCoord4i @ 160 + glTexCoord4s @ 161 + glTexCoord1dv @ 162 + glTexCoord1fv @ 163 + glTexCoord1iv @ 164 + glTexCoord1sv @ 165 + glTexCoord2dv @ 166 + glTexCoord2fv @ 167 + glTexCoord2iv @ 168 + glTexCoord2sv @ 169 + glTexCoord3dv @ 170 + glTexCoord3fv @ 171 + glTexCoord3iv @ 172 + glTexCoord3sv @ 173 + glTexCoord4dv @ 174 + glTexCoord4fv @ 175 + glTexCoord4iv @ 176 + glTexCoord4sv @ 177 + glRasterPos2d @ 178 + glRasterPos2f @ 179 + glRasterPos2i @ 180 + glRasterPos2s @ 181 + glRasterPos3d @ 182 + glRasterPos3f @ 183 + glRasterPos3i @ 184 + glRasterPos3s @ 185 + glRasterPos4d @ 186 + glRasterPos4f @ 187 + glRasterPos4i @ 188 + glRasterPos4s @ 189 + glRasterPos2dv @ 190 + glRasterPos2fv @ 191 + glRasterPos2iv @ 192 + glRasterPos2sv @ 193 + glRasterPos3dv @ 194 + glRasterPos3fv @ 195 + glRasterPos3iv @ 196 + glRasterPos3sv @ 197 + glRasterPos4dv @ 198 + glRasterPos4fv @ 199 + glRasterPos4iv @ 200 + glRasterPos4sv @ 201 + glRectd @ 202 + glRectf @ 203 + glRecti @ 204 + glRects @ 205 + glRectdv @ 206 + glRectfv @ 207 + glRectiv @ 208 + glRectsv @ 209 + glShadeModel @ 210 + glLightf @ 211 + glLighti @ 212 + glLightfv @ 213 + glLightiv @ 214 + glGetLightfv @ 215 + glGetLightiv @ 216 + glLightModelf @ 217 + glLightModeli @ 218 + glLightModelfv @ 219 + glLightModeliv @ 220 + glMaterialf @ 221 + glMateriali @ 222 + glMaterialfv @ 223 + glMaterialiv @ 224 + glGetMaterialfv @ 225 + glGetMaterialiv @ 226 + glColorMaterial @ 227 + glPixelZoom @ 228 + glPixelStoref @ 229 + glPixelStorei @ 230 + glPixelTransferf @ 231 + glPixelTransferi @ 232 + glPixelMapfv @ 233 + glPixelMapuiv @ 234 + glPixelMapusv @ 235 + glGetPixelMapfv @ 236 + glGetPixelMapuiv @ 237 + glGetPixelMapusv @ 238 + glBitmap @ 239 + glReadPixels @ 240 + glDrawPixels @ 241 + glCopyPixels @ 242 + glStencilFunc @ 243 + glStencilMask @ 244 + glStencilOp @ 245 + glClearStencil @ 246 + glTexGend @ 247 + glTexGenf @ 248 + glTexGeni @ 249 + glTexGendv @ 250 + glTexGenfv @ 251 + glTexGeniv @ 252 + glGetTexGendv @ 253 + glGetTexGenfv @ 254 + glGetTexGeniv @ 255 + glTexEnvf @ 256 + glTexEnvi @ 257 + glTexEnvfv @ 258 + glTexEnviv @ 259 + glGetTexEnvfv @ 260 + glGetTexEnviv @ 261 + glTexParameterf @ 262 + glTexParameteri @ 263 + glTexParameterfv @ 264 + glTexParameteriv @ 265 + glGetTexParameterfv @ 266 + glGetTexParameteriv @ 267 + glGetTexLevelParameterfv @ 268 + glGetTexLevelParameteriv @ 269 + glTexImage1D @ 270 + glTexImage2D @ 271 + glGetTexImage @ 272 + glMap1d @ 273 + glMap1f @ 274 + glMap2d @ 275 + glMap2f @ 276 + glGetMapdv @ 277 + glGetMapfv @ 278 + glGetMapiv @ 279 + glEvalCoord1d @ 280 + glEvalCoord1f @ 281 + glEvalCoord1dv @ 282 + glEvalCoord1fv @ 283 + glEvalCoord2d @ 284 + glEvalCoord2f @ 285 + glEvalCoord2dv @ 286 + glEvalCoord2fv @ 287 + glMapGrid1d @ 288 + glMapGrid1f @ 289 + glMapGrid2d @ 290 + glMapGrid2f @ 291 + glEvalPoint1 @ 292 + glEvalPoint2 @ 293 + glEvalMesh1 @ 294 + glEvalMesh2 @ 295 + glFogf @ 296 + glFogi @ 297 + glFogfv @ 298 + glFogiv @ 299 + glFeedbackBuffer @ 300 + glPassThrough @ 301 + glSelectBuffer @ 302 + glInitNames @ 303 + glLoadName @ 304 + glPushName @ 305 + glPopName @ 306 +; glBlendEquationEXT @ 307 +; glBlendColorEXT @ 308 + glPolygonOffset @ 309 +; glVertexPointerEXT @ 310 +; glNormalPointerEXT @ 311 +; glColorPointerEXT @ 312 +; glIndexPointerEXT @ 313 +; glTexCoordPointerEXT @ 314 +; glEdgeFlagPointerEXT @ 315 +; glGetPointervEXT @ 316 +; glArrayElementEXT @ 317 +; glDrawArraysEXT @ 318 +; OSMesaCreateContext @ 319 +; OSMesaDestroyContext @ 320 +; OSMesaMakeCurrent @ 321 +; XMesaCreateContext @ 322 +; XMesaDestroyContext @ 323 +; XMesaMakeCurrent @ 326 +; XMesaGetCurrentContext @ 327 +; XMesaSwapBuffers @ 328 +; XMesaGetBackBuffer @ 329 + glXChooseVisual @ 330 + glXCreateContext @ 331 + glXDestroyContext @ 332 + glXMakeCurrent @ 333 + glXCopyContext @ 334 + glXSwapBuffers @ 335 + glXCreateGLXPixmap @ 336 + glXDestroyGLXPixmap @ 337 + glXQueryExtension @ 338 + glXQueryVersion @ 339 + glXIsDirect @ 340 + glXGetConfig @ 341 + glXGetCurrentContext @ 342 + glXGetCurrentDrawable @ 343 + glXWaitGL @ 344 + glXWaitX @ 345 + glXUseXFont @ 346 + glXQueryExtensionsString @ 347 + glXQueryServerString @ 348 + glXGetClientString @ 349 + glPushClientAttrib @ 350 + glPopClientAttrib @ 351 + glIndexub @ 352 + glIndexubv @ 353 + glVertexPointer @ 354 + glNormalPointer @ 355 + glColorPointer @ 356 + glIndexPointer @ 357 + glTexCoordPointer @ 358 + glEdgeFlagPointer @ 359 + glGetPointerv @ 360 + glArrayElement @ 361 + glDrawArrays @ 362 + glDrawElements @ 363 + glInterleavedArrays @ 364 + glGenTextures @ 365 + glDeleteTextures @ 366 + glBindTexture @ 367 + glPrioritizeTextures @ 368 + glAreTexturesResident @ 369 + glIsTexture @ 370 + glTexSubImage1D @ 371 + glTexSubImage2D @ 372 + glCopyTexImage1D @ 373 + glCopyTexImage2D @ 374 + glCopyTexSubImage1D @ 375 + glCopyTexSubImage2D @ 376 +; glWindowPos2iMESA @ 377 +; glWindowPos2sMESA @ 378 +; glWindowPos2fMESA @ 379 +; glWindowPos2dMESA @ 380 +; glWindowPos2ivMESA @ 381 +; glWindowPos2svMESA @ 382 +; glWindowPos2fvMESA @ 383 +; glWindowPos2dvMESA @ 384 +; glWindowPos3iMESA @ 385 +; glWindowPos3sMESA @ 386 +; glWindowPos3fMESA @ 387 +; glWindowPos3dMESA @ 388 +; glWindowPos3ivMESA @ 389 +; glWindowPos3svMESA @ 390 +; glWindowPos3fvMESA @ 391 +; glWindowPos3dvMESA @ 392 +; glWindowPos4iMESA @ 393 +; glWindowPos4sMESA @ 394 +; glWindowPos4fMESA @ 395 +; glWindowPos4dMESA @ 396 +; glWindowPos4ivMESA @ 397 +; glWindowPos4svMESA @ 398 +; glWindowPos4fvMESA @ 399 +; glWindowPos4dvMESA @ 400 +; glXCreateGLXPixmapMESA @ 401 +; glXReleaseBuffersMESA @ 402 +; OSMesaGetCurrentContext @ 403 +; OSMesaPixelStore @ 404 +; OSMesaGetIntegerv @ 405 +; XMesaCreateVisual @ 406 +; XMesaDestroyVisual @ 407 +; XMesaCreateWindowBuffer @ 408 +; XMesaCreatePixmapBuffer @ 409 +; XMesaDestroyBuffer @ 410 +; XMesaGetCurrentBuffer @ 411 +; XMesaFlush @ 412 +; XMesaGetString @ 413 +; glPolygonOffsetEXT @ 414 + glDisableClientState @ 450 + glEnableClientState @ 451 + glXFreeContextEXT @ 452 + glXGetContextIDEXT @ 453 + glXGetCurrentDisplay @ 454 + glXImportContextEXT @ 455 + glXQueryContextInfoEXT @ 456 + glXGetCurrentDrawableEXT @ 457 + glCopyTexSubImage3D @ 458 + glDrawRangeElements @ 459 + glTexSubImage3D @ 460 + glBlendColorEXT @ 461 + glBlendEquationEXT @ 462 + glTexImage3D @ 463 + +/* $XFree86: xc/lib/GL/GL-def.cpp,v 1.1 2000/08/09 23:40:11 dawes Exp $ */ diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile index e4a87c833..0bbc3fcd2 100644 --- a/xc/lib/GL/Imakefile +++ b/xc/lib/GL/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.28 2000/06/30 19:30:16 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.29 2000/07/02 19:23:34 dawes Exp $ #include <Threads.tmpl> @@ -290,6 +290,7 @@ SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(GLXSUBDIRS) $(DONES),$(OBJS) $(THRE InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) #if LinkGLToUsrLib && AlternateUsrLibDir install:: + MakeDir($(DESTDIR)$(SYSTEMUSRLIBDIR)) $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so $(LN) $(SHLIBDIR)/lib$(LIBNAME).so $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 diff --git a/xc/lib/GL/dri/drm/Imakefile b/xc/lib/GL/dri/drm/Imakefile index 89859ab29..0433cd081 100644 --- a/xc/lib/GL/dri/drm/Imakefile +++ b/xc/lib/GL/dri/drm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.6 2000/06/30 17:15:07 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.7 2000/08/09 23:40:11 dawes Exp $ #define DoNormalLib NormalLibGlx #define DoSharedLib SharedLibGlx @@ -23,6 +23,9 @@ OS_SUBDIR = linux #if defined(FreeBSDArchitecture) || defined(BSDOSArchitecture) OS_SUBDIR = bsd #endif +#if defined(cygwinArchitecture) +OS_SUBDIR = cygwin +#endif LinkSourceFile(xf86drm.c,$(XF86OSSRC)/$(OS_SUBDIR)/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/$(OS_SUBDIR)/drm) diff --git a/xc/lib/GL/glx/Imakefile b/xc/lib/GL/glx/Imakefile index 8b63c26b5..8f3111bdb 100644 --- a/xc/lib/GL/glx/Imakefile +++ b/xc/lib/GL/glx/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/glx/Imakefile,v 1.10 2000/06/30 17:15:07 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/glx/Imakefile,v 1.11 2000/08/01 20:28:38 dawes Exp $ XCOMM The contents of this file are subject to the GLX Public License Version 1.0 XCOMM (the "License"). You may not use this file except in compliance with the XCOMM License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -31,18 +31,18 @@ XCOMM SUBDIRS = \ XCOMM glu \ XCOMM glw -LinkSourceFile(glapi.c, ../../../extras/Mesa/src) -LinkSourceFile(glapi.h, ../../../extras/Mesa/src) -LinkSourceFile(glapinoop.c, ../../../extras/Mesa/src) -LinkSourceFile(glapinoop.h, ../../../extras/Mesa/src) -LinkSourceFile(glapioffsets.h, ../../../extras/Mesa/src) -LinkSourceFile(glapitable.h, ../../../extras/Mesa/src) -LinkSourceFile(glapitemp.h, ../../../extras/Mesa/src) -LinkSourceFile(glheader.h, ../../../extras/Mesa/src) -LinkSourceFile(glthread.c, ../../../extras/Mesa/src) -LinkSourceFile(glthread.h, ../../../extras/Mesa/src) -LinkSourceFile(glapi_x86.S, ../../../extras/Mesa/src/X86) -LinkSourceFile(assyntax.h, ../../../extras/Mesa/src/X86) +LinkSourceFile(glapi.c, $(MESASRCDIR)/src) +LinkSourceFile(glapi.h, $(MESASRCDIR)/src) +LinkSourceFile(glapinoop.c, $(MESASRCDIR)/src) +LinkSourceFile(glapinoop.h, $(MESASRCDIR)/src) +LinkSourceFile(glapioffsets.h, $(MESASRCDIR)/src) +LinkSourceFile(glapitable.h, $(MESASRCDIR)/src) +LinkSourceFile(glapitemp.h, $(MESASRCDIR)/src) +LinkSourceFile(glheader.h, $(MESASRCDIR)/src) +LinkSourceFile(glthread.c, $(MESASRCDIR)/src) +LinkSourceFile(glthread.h, $(MESASRCDIR)/src) +LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(assyntax.h, $(MESASRCDIR)/src/X86) GLX_SRCS = \ clientattrib.c \ diff --git a/xc/lib/GL/mesa/include/GL/Imakefile b/xc/lib/GL/mesa/include/GL/Imakefile index c04463501..c48636a19 100644 --- a/xc/lib/GL/mesa/include/GL/Imakefile +++ b/xc/lib/GL/mesa/include/GL/Imakefile @@ -1,15 +1,15 @@ -XCOMM $XFree86: xc/lib/GL/mesa/include/GL/Imakefile,v 1.5 2000/06/30 18:27:00 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/include/GL/Imakefile,v 1.6 2000/08/01 20:28:38 dawes Exp $ #define IHaveModules #include <Server.tmpl> DEFINES = $(GLX_DEFINES) -LinkSourceFile(gl.h, ../../../../../extras/Mesa/include/GL) -LinkSourceFile(glext.h, ../../../../../extras/Mesa/include/GL) -LinkSourceFile(glx.h, ../../../../../include/GL) -LinkSourceFile(glxtokens.h, ../../../../../include/GL) -LinkSourceFile(xmesa.h, ../../../../../extras/Mesa/include/GL) -LinkSourceFile(xmesa_x.h, ../../../../../extras/Mesa/include/GL) -LinkSourceFile(xmesa_xf86.h, ../../../../../extras/Mesa/include/GL) -LinkSourceFile(osmesa.h, ../../../../../extras/Mesa/include/GL) +LinkSourceFile(gl.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(glext.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(glx.h, $(TOP)/include/GL) +LinkSourceFile(glxtokens.h, $(TOP)/include/GL) +LinkSourceFile(xmesa.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(xmesa_x.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(xmesa_xf86.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(osmesa.h, $(MESASRCDIR)/include/GL) diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile index c8539e639..779cde990 100644 --- a/xc/lib/GL/mesa/src/Imakefile +++ b/xc/lib/GL/mesa/src/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.15 2000/06/24 16:14:07 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.16 2000/08/01 20:28:38 dawes Exp $ #include <Threads.tmpl> @@ -16,185 +16,185 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL TDFX_DEFS = -DFX #endif -LinkSourceFile(aatriangle.c, ../../../../extras/Mesa/src) -LinkSourceFile(aatriangle.h, ../../../../extras/Mesa/src) -LinkSourceFile(aatritemp.h, ../../../../extras/Mesa/src) -LinkSourceFile(accum.c, ../../../../extras/Mesa/src) -LinkSourceFile(accum.h, ../../../../extras/Mesa/src) -LinkSourceFile(all.h, ../../../../extras/Mesa/src) -LinkSourceFile(alpha.c, ../../../../extras/Mesa/src) -LinkSourceFile(alpha.h, ../../../../extras/Mesa/src) -LinkSourceFile(alphabuf.c, ../../../../extras/Mesa/src) -LinkSourceFile(alphabuf.h, ../../../../extras/Mesa/src) -LinkSourceFile(attrib.c, ../../../../extras/Mesa/src) -LinkSourceFile(attrib.h, ../../../../extras/Mesa/src) -LinkSourceFile(bbox.c, ../../../../extras/Mesa/src) -LinkSourceFile(bbox.h, ../../../../extras/Mesa/src) -LinkSourceFile(bitmap.c, ../../../../extras/Mesa/src) -LinkSourceFile(bitmap.h, ../../../../extras/Mesa/src) -LinkSourceFile(blend.c, ../../../../extras/Mesa/src) -LinkSourceFile(blend.h, ../../../../extras/Mesa/src) -LinkSourceFile(buffers.c, ../../../../extras/Mesa/src) -LinkSourceFile(buffers.h, ../../../../extras/Mesa/src) -LinkSourceFile(clip.c, ../../../../extras/Mesa/src) -LinkSourceFile(clip.h, ../../../../extras/Mesa/src) -LinkSourceFile(clip_funcs.h, ../../../../extras/Mesa/src) -LinkSourceFile(clip_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(colortab.c, ../../../../extras/Mesa/src) -LinkSourceFile(colortab.h, ../../../../extras/Mesa/src) -LinkSourceFile(config.c, ../../../../extras/Mesa/src) -LinkSourceFile(config.h, ../../../../extras/Mesa/src) -LinkSourceFile(context.c, ../../../../extras/Mesa/src) -LinkSourceFile(context.h, ../../../../extras/Mesa/src) -LinkSourceFile(copy_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(copypix.c, ../../../../extras/Mesa/src) -LinkSourceFile(copypix.h, ../../../../extras/Mesa/src) -LinkSourceFile(cull_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(cva.c, ../../../../extras/Mesa/src) -LinkSourceFile(cva.h, ../../../../extras/Mesa/src) -LinkSourceFile(dd.h, ../../../../extras/Mesa/src) -LinkSourceFile(debug_xform.c, ../../../../extras/Mesa/src) -LinkSourceFile(debug_xform.h, ../../../../extras/Mesa/src) -LinkSourceFile(depth.c, ../../../../extras/Mesa/src) -LinkSourceFile(depth.h, ../../../../extras/Mesa/src) -LinkSourceFile(dlist.c, ../../../../extras/Mesa/src) -LinkSourceFile(dlist.h, ../../../../extras/Mesa/src) -LinkSourceFile(dotprod_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(drawpix.c, ../../../../extras/Mesa/src) -LinkSourceFile(drawpix.h, ../../../../extras/Mesa/src) -LinkSourceFile(enable.c, ../../../../extras/Mesa/src) -LinkSourceFile(enable.h, ../../../../extras/Mesa/src) -LinkSourceFile(enums.c, ../../../../extras/Mesa/src) -LinkSourceFile(enums.h, ../../../../extras/Mesa/src) -LinkSourceFile(eval.c, ../../../../extras/Mesa/src) -LinkSourceFile(eval.h, ../../../../extras/Mesa/src) -LinkSourceFile(extensions.c, ../../../../extras/Mesa/src) -LinkSourceFile(extensions.h, ../../../../extras/Mesa/src) -LinkSourceFile(feedback.c, ../../../../extras/Mesa/src) -LinkSourceFile(feedback.h, ../../../../extras/Mesa/src) -LinkSourceFile(fixed.h, ../../../../extras/Mesa/src) -LinkSourceFile(fog.c, ../../../../extras/Mesa/src) -LinkSourceFile(fog.h, ../../../../extras/Mesa/src) -LinkSourceFile(fog_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(general_clip.h, ../../../../extras/Mesa/src) -LinkSourceFile(get.c, ../../../../extras/Mesa/src) -LinkSourceFile(get.h, ../../../../extras/Mesa/src) -LinkSourceFile(glapi.c, ../../../../extras/Mesa/src) -LinkSourceFile(glapi.h, ../../../../extras/Mesa/src) -LinkSourceFile(glapinoop.c, ../../../../extras/Mesa/src) -LinkSourceFile(glapinoop.h, ../../../../extras/Mesa/src) -LinkSourceFile(glapioffsets.h, ../../../../extras/Mesa/src) -LinkSourceFile(glapitable.h, ../../../../extras/Mesa/src) -LinkSourceFile(glapitemp.h, ../../../../extras/Mesa/src) -LinkSourceFile(glheader.h, ../../../../extras/Mesa/src) -LinkSourceFile(glthread.c, ../../../../extras/Mesa/src) -LinkSourceFile(glthread.h, ../../../../extras/Mesa/src) -LinkSourceFile(hash.c, ../../../../extras/Mesa/src) -LinkSourceFile(hash.h, ../../../../extras/Mesa/src) -LinkSourceFile(hint.c, ../../../../extras/Mesa/src) -LinkSourceFile(hint.h, ../../../../extras/Mesa/src) -LinkSourceFile(image.c, ../../../../extras/Mesa/src) -LinkSourceFile(image.h, ../../../../extras/Mesa/src) -LinkSourceFile(imaging.c, ../../../../extras/Mesa/src) -LinkSourceFile(imaging.h, ../../../../extras/Mesa/src) -LinkSourceFile(indirect_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(interp_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(light.c, ../../../../extras/Mesa/src) -LinkSourceFile(light.h, ../../../../extras/Mesa/src) -LinkSourceFile(lines.c, ../../../../extras/Mesa/src) -LinkSourceFile(lines.h, ../../../../extras/Mesa/src) -LinkSourceFile(linetemp.h, ../../../../extras/Mesa/src) -LinkSourceFile(lnaatemp.h, ../../../../extras/Mesa/src) -LinkSourceFile(logic.c, ../../../../extras/Mesa/src) -LinkSourceFile(logic.h, ../../../../extras/Mesa/src) -LinkSourceFile(macros.h, ../../../../extras/Mesa/src) -LinkSourceFile(masking.c, ../../../../extras/Mesa/src) -LinkSourceFile(masking.h, ../../../../extras/Mesa/src) -LinkSourceFile(matrix.c, ../../../../extras/Mesa/src) -LinkSourceFile(matrix.h, ../../../../extras/Mesa/src) -LinkSourceFile(mem.c, ../../../../extras/Mesa/src) -LinkSourceFile(mem.h, ../../../../extras/Mesa/src) -LinkSourceFile(mmath.c, ../../../../extras/Mesa/src) -LinkSourceFile(mmath.h, ../../../../extras/Mesa/src) -LinkSourceFile(norm_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(pb.c, ../../../../extras/Mesa/src) -LinkSourceFile(pb.h, ../../../../extras/Mesa/src) -LinkSourceFile(pipeline.c, ../../../../extras/Mesa/src) -LinkSourceFile(pipeline.h, ../../../../extras/Mesa/src) -LinkSourceFile(pixel.c, ../../../../extras/Mesa/src) -LinkSourceFile(pixel.h, ../../../../extras/Mesa/src) -LinkSourceFile(pixeltex.c, ../../../../extras/Mesa/src) -LinkSourceFile(pixeltex.h, ../../../../extras/Mesa/src) -LinkSourceFile(points.c, ../../../../extras/Mesa/src) -LinkSourceFile(points.h, ../../../../extras/Mesa/src) -LinkSourceFile(polygon.c, ../../../../extras/Mesa/src) -LinkSourceFile(polygon.h, ../../../../extras/Mesa/src) -LinkSourceFile(quads.c, ../../../../extras/Mesa/src) -LinkSourceFile(quads.h, ../../../../extras/Mesa/src) -LinkSourceFile(rastpos.c, ../../../../extras/Mesa/src) -LinkSourceFile(rastpos.h, ../../../../extras/Mesa/src) -LinkSourceFile(readpix.c, ../../../../extras/Mesa/src) -LinkSourceFile(readpix.h, ../../../../extras/Mesa/src) -LinkSourceFile(rect.c, ../../../../extras/Mesa/src) -LinkSourceFile(rect.h, ../../../../extras/Mesa/src) -LinkSourceFile(render_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(scissor.c, ../../../../extras/Mesa/src) -LinkSourceFile(scissor.h, ../../../../extras/Mesa/src) -LinkSourceFile(shade.c, ../../../../extras/Mesa/src) -LinkSourceFile(shade.h, ../../../../extras/Mesa/src) -LinkSourceFile(shade_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(simple_list.h, ../../../../extras/Mesa/src) -LinkSourceFile(span.c, ../../../../extras/Mesa/src) -LinkSourceFile(span.h, ../../../../extras/Mesa/src) -LinkSourceFile(stages.c, ../../../../extras/Mesa/src) -LinkSourceFile(stages.h, ../../../../extras/Mesa/src) -LinkSourceFile(state.c, ../../../../extras/Mesa/src) -LinkSourceFile(state.h, ../../../../extras/Mesa/src) -LinkSourceFile(stencil.c, ../../../../extras/Mesa/src) -LinkSourceFile(stencil.h, ../../../../extras/Mesa/src) -LinkSourceFile(texgen_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(teximage.c, ../../../../extras/Mesa/src) -LinkSourceFile(teximage.h, ../../../../extras/Mesa/src) -LinkSourceFile(texobj.c, ../../../../extras/Mesa/src) -LinkSourceFile(texobj.h, ../../../../extras/Mesa/src) -LinkSourceFile(texstate.c, ../../../../extras/Mesa/src) -LinkSourceFile(texstate.h, ../../../../extras/Mesa/src) -LinkSourceFile(texture.c, ../../../../extras/Mesa/src) -LinkSourceFile(texture.h, ../../../../extras/Mesa/src) -LinkSourceFile(texutil.c, ../../../../extras/Mesa/src) -LinkSourceFile(texutil.h, ../../../../extras/Mesa/src) -LinkSourceFile(trans_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(translate.c, ../../../../extras/Mesa/src) -LinkSourceFile(translate.h, ../../../../extras/Mesa/src) -LinkSourceFile(triangle.c, ../../../../extras/Mesa/src) -LinkSourceFile(triangle.h, ../../../../extras/Mesa/src) -LinkSourceFile(tritemp.h, ../../../../extras/Mesa/src) -LinkSourceFile(types.h, ../../../../extras/Mesa/src) -LinkSourceFile(varray.c, ../../../../extras/Mesa/src) -LinkSourceFile(varray.h, ../../../../extras/Mesa/src) -LinkSourceFile(vb.c, ../../../../extras/Mesa/src) -LinkSourceFile(vb.h, ../../../../extras/Mesa/src) -LinkSourceFile(vbcull.c, ../../../../extras/Mesa/src) -LinkSourceFile(vbcull.h, ../../../../extras/Mesa/src) -LinkSourceFile(vbfill.c, ../../../../extras/Mesa/src) -LinkSourceFile(vbfill.h, ../../../../extras/Mesa/src) -LinkSourceFile(vbindirect.c, ../../../../extras/Mesa/src) -LinkSourceFile(vbindirect.h, ../../../../extras/Mesa/src) -LinkSourceFile(vbrender.c, ../../../../extras/Mesa/src) -LinkSourceFile(vbrender.h, ../../../../extras/Mesa/src) -LinkSourceFile(vbxform.c, ../../../../extras/Mesa/src) -LinkSourceFile(vbxform.h, ../../../../extras/Mesa/src) -LinkSourceFile(vector.c, ../../../../extras/Mesa/src) -LinkSourceFile(vector.h, ../../../../extras/Mesa/src) -LinkSourceFile(vertices.c, ../../../../extras/Mesa/src) -LinkSourceFile(vertices.h, ../../../../extras/Mesa/src) -LinkSourceFile(winpos.c, ../../../../extras/Mesa/src) -LinkSourceFile(winpos.h, ../../../../extras/Mesa/src) -LinkSourceFile(xform.c, ../../../../extras/Mesa/src) -LinkSourceFile(xform.h, ../../../../extras/Mesa/src) -LinkSourceFile(xform_tmp.h, ../../../../extras/Mesa/src) -LinkSourceFile(zoom.c, ../../../../extras/Mesa/src) -LinkSourceFile(zoom.h, ../../../../extras/Mesa/src) +LinkSourceFile(aatriangle.c, $(MESASRCDIR)/src) +LinkSourceFile(aatriangle.h, $(MESASRCDIR)/src) +LinkSourceFile(aatritemp.h, $(MESASRCDIR)/src) +LinkSourceFile(accum.c, $(MESASRCDIR)/src) +LinkSourceFile(accum.h, $(MESASRCDIR)/src) +LinkSourceFile(all.h, $(MESASRCDIR)/src) +LinkSourceFile(alpha.c, $(MESASRCDIR)/src) +LinkSourceFile(alpha.h, $(MESASRCDIR)/src) +LinkSourceFile(alphabuf.c, $(MESASRCDIR)/src) +LinkSourceFile(alphabuf.h, $(MESASRCDIR)/src) +LinkSourceFile(attrib.c, $(MESASRCDIR)/src) +LinkSourceFile(attrib.h, $(MESASRCDIR)/src) +LinkSourceFile(bbox.c, $(MESASRCDIR)/src) +LinkSourceFile(bbox.h, $(MESASRCDIR)/src) +LinkSourceFile(bitmap.c, $(MESASRCDIR)/src) +LinkSourceFile(bitmap.h, $(MESASRCDIR)/src) +LinkSourceFile(blend.c, $(MESASRCDIR)/src) +LinkSourceFile(blend.h, $(MESASRCDIR)/src) +LinkSourceFile(buffers.c, $(MESASRCDIR)/src) +LinkSourceFile(buffers.h, $(MESASRCDIR)/src) +LinkSourceFile(clip.c, $(MESASRCDIR)/src) +LinkSourceFile(clip.h, $(MESASRCDIR)/src) +LinkSourceFile(clip_funcs.h, $(MESASRCDIR)/src) +LinkSourceFile(clip_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(colortab.c, $(MESASRCDIR)/src) +LinkSourceFile(colortab.h, $(MESASRCDIR)/src) +LinkSourceFile(config.c, $(MESASRCDIR)/src) +LinkSourceFile(config.h, $(MESASRCDIR)/src) +LinkSourceFile(context.c, $(MESASRCDIR)/src) +LinkSourceFile(context.h, $(MESASRCDIR)/src) +LinkSourceFile(copy_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(copypix.c, $(MESASRCDIR)/src) +LinkSourceFile(copypix.h, $(MESASRCDIR)/src) +LinkSourceFile(cull_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(cva.c, $(MESASRCDIR)/src) +LinkSourceFile(cva.h, $(MESASRCDIR)/src) +LinkSourceFile(dd.h, $(MESASRCDIR)/src) +LinkSourceFile(debug_xform.c, $(MESASRCDIR)/src) +LinkSourceFile(debug_xform.h, $(MESASRCDIR)/src) +LinkSourceFile(depth.c, $(MESASRCDIR)/src) +LinkSourceFile(depth.h, $(MESASRCDIR)/src) +LinkSourceFile(dlist.c, $(MESASRCDIR)/src) +LinkSourceFile(dlist.h, $(MESASRCDIR)/src) +LinkSourceFile(dotprod_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(drawpix.c, $(MESASRCDIR)/src) +LinkSourceFile(drawpix.h, $(MESASRCDIR)/src) +LinkSourceFile(enable.c, $(MESASRCDIR)/src) +LinkSourceFile(enable.h, $(MESASRCDIR)/src) +LinkSourceFile(enums.c, $(MESASRCDIR)/src) +LinkSourceFile(enums.h, $(MESASRCDIR)/src) +LinkSourceFile(eval.c, $(MESASRCDIR)/src) +LinkSourceFile(eval.h, $(MESASRCDIR)/src) +LinkSourceFile(extensions.c, $(MESASRCDIR)/src) +LinkSourceFile(extensions.h, $(MESASRCDIR)/src) +LinkSourceFile(feedback.c, $(MESASRCDIR)/src) +LinkSourceFile(feedback.h, $(MESASRCDIR)/src) +LinkSourceFile(fixed.h, $(MESASRCDIR)/src) +LinkSourceFile(fog.c, $(MESASRCDIR)/src) +LinkSourceFile(fog.h, $(MESASRCDIR)/src) +LinkSourceFile(fog_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(general_clip.h, $(MESASRCDIR)/src) +LinkSourceFile(get.c, $(MESASRCDIR)/src) +LinkSourceFile(get.h, $(MESASRCDIR)/src) +LinkSourceFile(glapi.c, $(MESASRCDIR)/src) +LinkSourceFile(glapi.h, $(MESASRCDIR)/src) +LinkSourceFile(glapinoop.c, $(MESASRCDIR)/src) +LinkSourceFile(glapinoop.h, $(MESASRCDIR)/src) +LinkSourceFile(glapioffsets.h, $(MESASRCDIR)/src) +LinkSourceFile(glapitable.h, $(MESASRCDIR)/src) +LinkSourceFile(glapitemp.h, $(MESASRCDIR)/src) +LinkSourceFile(glheader.h, $(MESASRCDIR)/src) +LinkSourceFile(glthread.c, $(MESASRCDIR)/src) +LinkSourceFile(glthread.h, $(MESASRCDIR)/src) +LinkSourceFile(hash.c, $(MESASRCDIR)/src) +LinkSourceFile(hash.h, $(MESASRCDIR)/src) +LinkSourceFile(hint.c, $(MESASRCDIR)/src) +LinkSourceFile(hint.h, $(MESASRCDIR)/src) +LinkSourceFile(image.c, $(MESASRCDIR)/src) +LinkSourceFile(image.h, $(MESASRCDIR)/src) +LinkSourceFile(imaging.c, $(MESASRCDIR)/src) +LinkSourceFile(imaging.h, $(MESASRCDIR)/src) +LinkSourceFile(indirect_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(interp_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(light.c, $(MESASRCDIR)/src) +LinkSourceFile(light.h, $(MESASRCDIR)/src) +LinkSourceFile(lines.c, $(MESASRCDIR)/src) +LinkSourceFile(lines.h, $(MESASRCDIR)/src) +LinkSourceFile(linetemp.h, $(MESASRCDIR)/src) +LinkSourceFile(lnaatemp.h, $(MESASRCDIR)/src) +LinkSourceFile(logic.c, $(MESASRCDIR)/src) +LinkSourceFile(logic.h, $(MESASRCDIR)/src) +LinkSourceFile(macros.h, $(MESASRCDIR)/src) +LinkSourceFile(masking.c, $(MESASRCDIR)/src) +LinkSourceFile(masking.h, $(MESASRCDIR)/src) +LinkSourceFile(matrix.c, $(MESASRCDIR)/src) +LinkSourceFile(matrix.h, $(MESASRCDIR)/src) +LinkSourceFile(mem.c, $(MESASRCDIR)/src) +LinkSourceFile(mem.h, $(MESASRCDIR)/src) +LinkSourceFile(mmath.c, $(MESASRCDIR)/src) +LinkSourceFile(mmath.h, $(MESASRCDIR)/src) +LinkSourceFile(norm_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(pb.c, $(MESASRCDIR)/src) +LinkSourceFile(pb.h, $(MESASRCDIR)/src) +LinkSourceFile(pipeline.c, $(MESASRCDIR)/src) +LinkSourceFile(pipeline.h, $(MESASRCDIR)/src) +LinkSourceFile(pixel.c, $(MESASRCDIR)/src) +LinkSourceFile(pixel.h, $(MESASRCDIR)/src) +LinkSourceFile(pixeltex.c, $(MESASRCDIR)/src) +LinkSourceFile(pixeltex.h, $(MESASRCDIR)/src) +LinkSourceFile(points.c, $(MESASRCDIR)/src) +LinkSourceFile(points.h, $(MESASRCDIR)/src) +LinkSourceFile(polygon.c, $(MESASRCDIR)/src) +LinkSourceFile(polygon.h, $(MESASRCDIR)/src) +LinkSourceFile(quads.c, $(MESASRCDIR)/src) +LinkSourceFile(quads.h, $(MESASRCDIR)/src) +LinkSourceFile(rastpos.c, $(MESASRCDIR)/src) +LinkSourceFile(rastpos.h, $(MESASRCDIR)/src) +LinkSourceFile(readpix.c, $(MESASRCDIR)/src) +LinkSourceFile(readpix.h, $(MESASRCDIR)/src) +LinkSourceFile(rect.c, $(MESASRCDIR)/src) +LinkSourceFile(rect.h, $(MESASRCDIR)/src) +LinkSourceFile(render_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(scissor.c, $(MESASRCDIR)/src) +LinkSourceFile(scissor.h, $(MESASRCDIR)/src) +LinkSourceFile(shade.c, $(MESASRCDIR)/src) +LinkSourceFile(shade.h, $(MESASRCDIR)/src) +LinkSourceFile(shade_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(simple_list.h, $(MESASRCDIR)/src) +LinkSourceFile(span.c, $(MESASRCDIR)/src) +LinkSourceFile(span.h, $(MESASRCDIR)/src) +LinkSourceFile(stages.c, $(MESASRCDIR)/src) +LinkSourceFile(stages.h, $(MESASRCDIR)/src) +LinkSourceFile(state.c, $(MESASRCDIR)/src) +LinkSourceFile(state.h, $(MESASRCDIR)/src) +LinkSourceFile(stencil.c, $(MESASRCDIR)/src) +LinkSourceFile(stencil.h, $(MESASRCDIR)/src) +LinkSourceFile(texgen_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(teximage.c, $(MESASRCDIR)/src) +LinkSourceFile(teximage.h, $(MESASRCDIR)/src) +LinkSourceFile(texobj.c, $(MESASRCDIR)/src) +LinkSourceFile(texobj.h, $(MESASRCDIR)/src) +LinkSourceFile(texstate.c, $(MESASRCDIR)/src) +LinkSourceFile(texstate.h, $(MESASRCDIR)/src) +LinkSourceFile(texture.c, $(MESASRCDIR)/src) +LinkSourceFile(texture.h, $(MESASRCDIR)/src) +LinkSourceFile(texutil.c, $(MESASRCDIR)/src) +LinkSourceFile(texutil.h, $(MESASRCDIR)/src) +LinkSourceFile(trans_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(translate.c, $(MESASRCDIR)/src) +LinkSourceFile(translate.h, $(MESASRCDIR)/src) +LinkSourceFile(triangle.c, $(MESASRCDIR)/src) +LinkSourceFile(triangle.h, $(MESASRCDIR)/src) +LinkSourceFile(tritemp.h, $(MESASRCDIR)/src) +LinkSourceFile(types.h, $(MESASRCDIR)/src) +LinkSourceFile(varray.c, $(MESASRCDIR)/src) +LinkSourceFile(varray.h, $(MESASRCDIR)/src) +LinkSourceFile(vb.c, $(MESASRCDIR)/src) +LinkSourceFile(vb.h, $(MESASRCDIR)/src) +LinkSourceFile(vbcull.c, $(MESASRCDIR)/src) +LinkSourceFile(vbcull.h, $(MESASRCDIR)/src) +LinkSourceFile(vbfill.c, $(MESASRCDIR)/src) +LinkSourceFile(vbfill.h, $(MESASRCDIR)/src) +LinkSourceFile(vbindirect.c, $(MESASRCDIR)/src) +LinkSourceFile(vbindirect.h, $(MESASRCDIR)/src) +LinkSourceFile(vbrender.c, $(MESASRCDIR)/src) +LinkSourceFile(vbrender.h, $(MESASRCDIR)/src) +LinkSourceFile(vbxform.c, $(MESASRCDIR)/src) +LinkSourceFile(vbxform.h, $(MESASRCDIR)/src) +LinkSourceFile(vector.c, $(MESASRCDIR)/src) +LinkSourceFile(vector.h, $(MESASRCDIR)/src) +LinkSourceFile(vertices.c, $(MESASRCDIR)/src) +LinkSourceFile(vertices.h, $(MESASRCDIR)/src) +LinkSourceFile(winpos.c, $(MESASRCDIR)/src) +LinkSourceFile(winpos.h, $(MESASRCDIR)/src) +LinkSourceFile(xform.c, $(MESASRCDIR)/src) +LinkSourceFile(xform.h, $(MESASRCDIR)/src) +LinkSourceFile(xform_tmp.h, $(MESASRCDIR)/src) +LinkSourceFile(zoom.c, $(MESASRCDIR)/src) +LinkSourceFile(zoom.h, $(MESASRCDIR)/src) CORE_SRCS = aatriangle.c \ accum.c \ diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile index ffc055f94..a38ddd585 100644 --- a/xc/lib/GL/mesa/src/OSmesa/Imakefile +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.3 2000/06/26 22:27:41 tsi Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.4 2000/08/01 20:28:38 dawes Exp $ #include <Threads.tmpl> @@ -8,7 +8,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.3 2000/06/26 22:27:41 ts #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx -LinkSourceFile(osmesa.c, ../../../../../extras/Mesa/src/OSmesa) +LinkSourceFile(osmesa.c, $(MESASRCDIR)/src/OSmesa) #if Malloc0ReturnsNull diff --git a/xc/lib/GL/mesa/src/OSmesa/OSmesa-def.cpp b/xc/lib/GL/mesa/src/OSmesa/OSmesa-def.cpp new file mode 100644 index 000000000..a2ec77a4d --- /dev/null +++ b/xc/lib/GL/mesa/src/OSmesa/OSmesa-def.cpp @@ -0,0 +1,25 @@ +LIBRARY libOSmesa +VERSION LIBRARY_VERSION +EXPORTS + OSMesaCreateContext + OSMesaDestroyContext + OSMesaGetColorBuffer + OSMesaGetCurrentContext + OSMesaGetDepthBuffer + OSMesaGetIntegerv + OSMesaMakeCurrent + OSMesaPixelStore + _glapi_Context + _glapi_noop_enable_warnings + _glapi_add_entrypoint + _glapi_get_dispatch_table_size + _glapi_set_dispatch + _glapi_check_multithread + _glapi_set_context + glTexCoordPointer + glColorPointer + glNormalPointer + glVertexPointer + glDrawElements + +/* $XFree86: xc/lib/GL/mesa/src/OSmesa/OSmesa-def.cpp,v 1.1 2000/08/09 23:40:12 dawes Exp $ */ diff --git a/xc/lib/GL/mesa/src/X/Imakefile b/xc/lib/GL/mesa/src/X/Imakefile index 27f799a65..1f9f01b46 100644 --- a/xc/lib/GL/mesa/src/X/Imakefile +++ b/xc/lib/GL/mesa/src/X/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.5 2000/02/23 04:46:39 martin Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.6 2000/08/01 20:28:39 dawes Exp $ #define DoNormalLib NormalLibGlx #define DoSharedLib SharedLibGlx @@ -6,12 +6,12 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.5 2000/02/23 04:46:39 martin #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx -LinkSourceFile(xmesa1.c, ../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa2.c, ../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa3.c, ../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa4.c, ../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesaP.h, ../../../../../extras/Mesa/src/X) -LinkSourceFile(glxheader.h, ../../../../../extras/Mesa/src/X) +LinkSourceFile(xmesa1.c, $(MESASRCDIR)/src/X) +LinkSourceFile(xmesa2.c, $(MESASRCDIR)/src/X) +LinkSourceFile(xmesa3.c, $(MESASRCDIR)/src/X) +LinkSourceFile(xmesa4.c, $(MESASRCDIR)/src/X) +LinkSourceFile(xmesaP.h, $(MESASRCDIR)/src/X) +LinkSourceFile(glxheader.h, $(MESASRCDIR)/src/X) #if Malloc0ReturnsNull diff --git a/xc/lib/GL/mesa/src/X86/Imakefile b/xc/lib/GL/mesa/src/X86/Imakefile index 9196fc40f..f97040009 100644 --- a/xc/lib/GL/mesa/src/X86/Imakefile +++ b/xc/lib/GL/mesa/src/X86/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.9 2000/06/17 00:02:53 martin Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.10 2000/08/01 20:28:39 dawes Exp $ #define DoNormalLib NormalLibGlx #define DoSharedLib SharedLibGlx @@ -6,34 +6,34 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.9 2000/06/17 00:02:53 marti #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx -LinkSourceFile(assyntax.h, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(common_x86.c, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(common_x86asm.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(common_x86asm.h, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(glapi_x86.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(x86.c, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(x86.h, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(x86a.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(vertex.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(x86flatregs.m4, ../../../../../extras/Mesa/src/X86) - -LinkSourceFile(mmx.h, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(mmx_blend.S, ../../../../../extras/Mesa/src/X86) - -LinkSourceFile(3dnow.c, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow.h, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_norm_raw.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_masked1.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_masked2.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_masked3.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_masked4.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_raw1.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_raw2.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_raw3.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(3dnow_xform_raw4.S, ../../../../../extras/Mesa/src/X86) -LinkSourceFile(vertex_3dnow.S, ../../../../../extras/Mesa/src/X86) - -LinkSourceFile(glapioffsets.h, ../../../../../extras/Mesa/src) +LinkSourceFile(assyntax.h, $(MESASRCDIR)/src/X86) +LinkSourceFile(common_x86.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(common_x86asm.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(common_x86asm.h, $(MESASRCDIR)/src/X86) +LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86.h, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86a.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(vertex.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86flatregs.m4, $(MESASRCDIR)/src/X86) + +LinkSourceFile(mmx.h, $(MESASRCDIR)/src/X86) +LinkSourceFile(mmx_blend.S, $(MESASRCDIR)/src/X86) + +LinkSourceFile(3dnow.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow.h, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_norm_raw.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_masked1.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_masked2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_masked3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_masked4.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_raw1.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_raw2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_raw3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_xform_raw4.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(vertex_3dnow.S, $(MESASRCDIR)/src/X86) + +LinkSourceFile(glapioffsets.h, $(MESASRCDIR)/src) #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL diff --git a/xc/lib/GL/mesa/src/drv/Imakefile b/xc/lib/GL/mesa/src/drv/Imakefile index 9a563be53..cdac99c61 100644 --- a/xc/lib/GL/mesa/src/drv/Imakefile +++ b/xc/lib/GL/mesa/src/drv/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.13 2000/06/30 19:30:17 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.14 2000/08/01 20:52:18 dawes Exp $ #define DoNormalLib NormalLibGlx #define DoSharedLib SharedLibGlx @@ -43,9 +43,7 @@ SUBDIRS += common SUBDIRS += mga SUBDIRS += i810 SUBDIRS += r128 -#if 0 SUBDIRS += sis -#endif #elif defined(AlphaArchitecture) SUBDIRS += gamma #if HasGlide3 diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_init.h b/xc/lib/GL/mesa/src/drv/i810/i810_init.h index df5362787..cdcdfd1b6 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_init.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810_init.h @@ -78,7 +78,7 @@ typedef struct { __DRIscreenPrivate *driScrnPriv; drmBufMapPtr bufs; - + int use_copy_buf; } i810ScreenPrivate; diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c index 1b54c277c..63d8f5826 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c @@ -24,7 +24,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/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.4 2000/06/22 16:59:24 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.5 2000/08/03 02:30:19 dawes Exp $ */ /* * Authors: @@ -92,6 +92,21 @@ static i810ContextPtr i810Ctx = 0; */ +static int i810_malloc_proxy_buf(drmBufMapPtr buffers) +{ + char *buffer; + drmBufPtr buf; + int i; + + buffer = Xmalloc(I810_DMA_BUF_SZ); + if(buffer == NULL) return -1; + for(i = 0; i < I810_DMA_BUF_NR; i++) { + buf = &(buffers->list[i]); + buf->address = (drmAddress)buffer; + } + return 0; +} + static drmBufMapPtr i810_create_empty_buffers(void) { drmBufMapPtr retval; @@ -141,7 +156,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DRM driver version is compatible */ if (sPriv->drmMajor != 1 || - sPriv->drmMinor != 0 || + sPriv->drmMinor != 1 || sPriv->drmPatch < 0) { char msg[1000]; sprintf(msg, "i810 DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); @@ -188,6 +203,17 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) Xfree(i810Screen); return GL_FALSE; } + + /* Check if you need to create a fake buffer */ + if(i810_check_copy(sPriv->fd) == 1) + { + i810_malloc_proxy_buf(i810Screen->bufs); + i810Screen->use_copy_buf = 1; + } + else + { + i810Screen->use_copy_buf = 0; + } i810Screen->back.handle = gDRIPriv->backbuffer; i810Screen->back.size = gDRIPriv->backbufferSize; diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c index b4e86cff2..8a31c94ff 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c @@ -45,7 +45,9 @@ static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa ) buf->idx = dma.request_idx; buf->used = 0; buf->total = dma.request_size; - buf->address = (drmAddress)dma.virtual; + + if(imesa->i810Screen->use_copy_buf != 1) + buf->address = (drmAddress)dma.virtual; return buf; } @@ -340,6 +342,16 @@ void i810FlushVerticesLocked( i810ContextPtr imesa ) if (nbox > I810_NR_SAREA_CLIPRECTS) imesa->dirty |= I810_UPLOAD_CLIPRECTS; + + if(imesa->i810Screen->use_copy_buf == 1 && vertex.used) { + drm_i810_copy_t copy; + + copy.idx = buffer->idx; + copy.used = buffer->used; + copy.address = buffer->address; + ioctl(imesa->driFd, DRM_IOCTL_I810_COPY, ©); + } + imesa->sarea->vertex_prim = imesa->vertex_prim; @@ -458,6 +470,11 @@ GLuint *i810AllocDwords( i810ContextPtr imesa, int dwords, GLuint prim ) return start; } +int i810_check_copy(int fd) +{ + return(ioctl(fd, DRM_IOCTL_I810_DOCOPY)); +} + static void i810DDFlush( GLcontext *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h index 004b723b4..6e698dd61 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h @@ -23,6 +23,8 @@ void i810DDInitIoctlFuncs( GLcontext *ctx ); void i810SwapBuffers( i810ContextPtr imesa ); +int i810_check_copy(int fd); + GLbitfield i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch ); diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile b/xc/lib/GL/mesa/src/drv/sis/Imakefile index ddef8bf56..2ed7b8c15 100644 --- a/xc/lib/GL/mesa/src/drv/sis/Imakefile +++ b/xc/lib/GL/mesa/src/drv/sis/Imakefile @@ -1,4 +1,4 @@ -XCOMM $PI:$ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.4 2000/08/11 17:27:10 dawes Exp $ #include <Threads.tmpl> @@ -18,6 +18,22 @@ XCOMM DEBUG_DEFINES = -DSIS_DEBUG ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif +#if defined(LinuxArchitecture) +OS_SUBDIR = linux +#endif +#if defined(FreeBSDArchitecture) || defined(BSDOSArchitecture) +OS_SUBDIR = bsd +#endif + +#ifdef i386Architecture +#ifdef MesaUse3DNow + ASM_DEFS = -DUSE_MMX_ASM -DUSE_X86_ASM -DUSE_3DNOW_ASM +#else + ASM_DEFS = -DUSE_MMX_ASM -DUSE_X86_ASM +#endif +#endif + + #if BuildXF86DRI DRI_DEFINES = GlxDefines $(SIS_DEFINES) DRI_INCLUDES = -I../../../../dri -I../../../../glx \ @@ -37,16 +53,12 @@ LinkSourceFile(xdriP.h, ../../X) #if 0 DEBUG_SRC = sis_debug.c DEBUG_OBJ = sis_debug.o - LinkSourceFile(sis_debug.c, ../../../../../../extras/Mesa/src/SIS) - LinkSourceFile(sis_debug.h, ../../../../../../extras/Mesa/src/SIS) DEBUG_DEFINES += -DSIS_DUMP #endif #if 0 STEREO_SRC = sis_stereo.c STEREO_OBJ = sis_stereo.o - LinkSourceFile(sis_stereo.c, ../../../../../../extras/Mesa/src/SIS) - LinkSourceFile(sis_stereo.h, ../../../../../../extras/Mesa/src/SIS) STEREO_DEFINES = -DSIS_STEREO=1 #else STEREO_DEFINES = -DSIS_STEREO=0 @@ -283,10 +295,16 @@ LinkSourceFile(xdriP.h, ../../X) ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) - SRCS = $(DRISRCS) $(DRMSRCS) $(SISSRCS) $(MESASRCS) $(ASMSRCS) - OBJS = $(DRIOBJS) $(DRMOBJS) $(SISOBJS) $(MESAOBJS) $(ASMOBJS) + SRCS = $(DRISRCS) $(DRMSRCS) $(SISSRCS) $(MESASRCS) $(ASMSRCS) + OBJS = $(DRIOBJS) $(DRMOBJS) $(SISOBJS) $(MESAOBJS) $(ASMOBJS) + +REQUIREDLIBS += -lm +#if !GlxBuiltInSIS +REQUIREDLIBS += -L../../../.. -lGL -L../../../../../X11 -lX11 +#endif + -#if !GlxUseBuiltInDRIDriver || GlxDebugSIS +#if !GlxUseBuiltInDRIDriver #undef DoNormalLib NormalLibGlx #undef DoExtraLib SharedLibGlx #undef DoDebugLib DebugLibGlx @@ -300,16 +318,12 @@ LibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) -#if !GlxUseBuiltInDRIDriver || GlxDebugSIS -# if GlxDebugSIS && GlxUseBuiltInDRIDriver -LIBNAME = libsis_dri.so -# else +#if !GlxUseBuiltInDRIDriver LIBNAME = sis_dri.so -# endif ALL_OBJS = $(OBJS) ALL_DEPS = DONE SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR)/dri,.) +InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #endif DependTarget() diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c b/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c index 6af0942c2..99c980e83 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_alloc.c,v 1.3 2000/08/04 03:51:41 tsi Exp $ */ + #include <assert.h> #include "sis_ctx.h" @@ -34,7 +36,7 @@ #if defined(XFree86Server) && !defined(XF86DRI) static void * -sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) { GLcontext *ctx = hwcx->gc; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; @@ -58,7 +60,7 @@ sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) } static void -sis_free (__GLSiScontext * hwcx, void *free) +sis_free_fb (__GLSiScontext * hwcx, void *free) { xf86FreeOffscreenArea ((FBAreaPtr) free); } @@ -72,7 +74,7 @@ static int _total_video_memory_used = 0; static int _total_video_memory_count = 0; static void * -sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) { GLcontext *ctx = hwcx->gc; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; @@ -83,25 +85,25 @@ sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) fb.context = xmesa->driContextPriv->hHWContext; fb.size = size; - if(ioctl(hwcx->drmSubFD, SIS_IOCTL_FB_ALLOC, &fb) || !fb.physical) + if(ioctl(hwcx->drmSubFD, SIS_IOCTL_FB_ALLOC, &fb) || !fb.offset) return NULL; *free = (void *)fb.free; /* debug */ - /* memset(fb.physical + GET_FbBase(hwcx), 0xff, size); */ + /* memset(fb.offset + GET_FbBase(hwcx), 0xff, size); */ if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_malloc: size=%u, offset=%lu, pid=%lu, count=%d\n", - size, (DWORD)fb.physical, (DWORD)getpid(), + fprintf(stderr, "sis_alloc_fb: size=%u, offset=%lu, pid=%lu, count=%d\n", + size, (DWORD)fb.offset, (DWORD)getpid(), ++_total_video_memory_count); } - return (void *)(fb.physical + GET_FbBase(hwcx)); + return (void *)(fb.offset + GET_FbBase(hwcx)); } static void -sis_free (__GLSiScontext * hwcx, void *free) +sis_free_fb (__GLSiScontext * hwcx, void *free) { GLcontext *ctx = hwcx->gc; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; @@ -110,7 +112,7 @@ sis_free (__GLSiScontext * hwcx, void *free) if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_free: free=%lu, pid=%lu, count=%d\n", + fprintf(stderr, "sis_free_fb: free=%lu, pid=%lu, count=%d\n", (DWORD)free, (DWORD)getpid(), --_total_video_memory_count); } @@ -122,7 +124,7 @@ sis_free (__GLSiScontext * hwcx, void *free) #else static void * -sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) { static char *vidmem_base = 0x400000; char *rval = vidmem_base; @@ -137,7 +139,7 @@ sis_malloc (__GLSiScontext * hwcx, GLuint size, void **free) } static void -sis_free (__GLSiScontext * hwcx, void *free) +sis_free_fb (__GLSiScontext * hwcx, void *free) { return; } @@ -146,6 +148,52 @@ sis_free (__GLSiScontext * hwcx, void *free) #endif +static void * +sis_alloc_agp (__GLSiScontext * hwcx, GLuint size, void **free) +{ + GLcontext *ctx = hwcx->gc; + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + + drm_sis_mem_t agp; + + if(!hwcx->AGPSize) + return NULL; + + agp.context = xmesa->driContextPriv->hHWContext; + agp.size = size; + if(ioctl(hwcx->drmSubFD, SIS_IOCTL_AGP_ALLOC, &agp) || !agp.offset) + return NULL; + *free = (void *)agp.free; + + if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) + { + fprintf(stderr, "sis_alloc_agp: size=%u, offset=%lu, pid=%lu, count=%d\n", + size, (DWORD)agp.offset, (DWORD)getpid(), + ++_total_video_memory_count); + } + + return (void *)(agp.offset + GET_AGPBase(hwcx)); +} + +static void +sis_free_agp (__GLSiScontext * hwcx, void *free) +{ + GLcontext *ctx = hwcx->gc; + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + + drm_sis_mem_t agp; + + if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) + { + fprintf(stderr, "sis_free_agp: free=%lu, pid=%lu, count=%d\n", + (DWORD)free, (DWORD)getpid(), --_total_video_memory_count); + } + + agp.context = xmesa->driContextPriv->hHWContext; + agp.free = (unsigned int)free; + ioctl(hwcx->drmSubFD, SIS_IOCTL_AGP_FREE, &agp); +} + /* debug */ static unsigned int Total_Real_Textures_Used = 0; static unsigned int Total_Textures_Used = 0; @@ -165,19 +213,18 @@ sis_alloc_z_stencil_buffer (GLcontext * ctx) GLubyte *addr; - z_depth = (xm_buffer->xm_visual->gl_visual->DepthBits + - xm_buffer->xm_visual->gl_visual->StencilBits) / 8; + z_depth = (ctx->Visual->DepthBits + ctx->Visual->StencilBits) / 8; width2 = ALIGNMENT (xm_buffer->width * z_depth, 4); totalBytes = xm_buffer->height * width2 + Z_BUFFER_HW_PLUS; - if (xm_buffer->gl_buffer->DepthBuffer) + if (xm_buffer->depthbuffer) { sis_free_z_stencil_buffer (xm_buffer); } - addr = sis_malloc (hwcx, totalBytes, &priv->zbFree); + addr = sis_alloc_fb (hwcx, totalBytes, &priv->zbFree); if (!addr) { fprintf (stderr, "SIS driver : out of video memory\n"); @@ -191,7 +238,7 @@ sis_alloc_z_stencil_buffer (GLcontext * ctx) addr = (GLubyte *) ALIGNMENT ((GLuint) addr, Z_BUFFER_HW_ALIGNMENT); - xm_buffer->gl_buffer->DepthBuffer = (void *) addr; + xm_buffer->depthbuffer = (void *) addr; /* software render */ hwcx->swZBase = addr; @@ -232,9 +279,9 @@ sis_free_z_stencil_buffer (XMesaBuffer buf) sisBufferInfo *priv = (sisBufferInfo *) buf->private; __GLSiScontext *hwcx = (__GLSiScontext *) buf->xm_context->private; - sis_free (hwcx, priv->zbFree); + sis_free_fb (hwcx, priv->zbFree); priv->zbFree = NULL; - buf->gl_buffer->DepthBuffer = NULL; + buf->depthbuffer = NULL; } void @@ -260,7 +307,7 @@ sis_alloc_back_image (GLcontext * ctx, XMesaImage *image, void **free, width2 = (depth == 2) ? ALIGNMENT (xm_buffer->width, 2) : xm_buffer->width; size = width2 * xm_buffer->height * depth + DRAW_BUFFER_HW_PLUS; - addr = sis_malloc (hwcx, size, free); + addr = sis_alloc_fb (hwcx, size, free); if (!addr) { fprintf (stderr, "SIS driver : out of video memory\n"); @@ -269,7 +316,7 @@ sis_alloc_back_image (GLcontext * ctx, XMesaImage *image, void **free, addr = (GLbyte *) ALIGNMENT ((GLuint) addr, DRAW_BUFFER_HW_ALIGNMENT); - image->data = addr; + image->data = (char *)addr; image->bytes_per_line = width2 * depth; image->bits_per_pixel = depth * 8; @@ -306,7 +353,7 @@ sis_free_back_image (XMesaBuffer buf, XMesaImage *image, void *free) { __GLSiScontext *hwcx = (__GLSiScontext *) buf->xm_context->private; - sis_free (hwcx, free); + sis_free_fb (hwcx, free); image->data = NULL; } @@ -403,13 +450,26 @@ sis_alloc_texture_image (GLcontext * ctx, GLtextureImage * image) size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; - addr = sis_malloc (hwcx, size, &area->pArea); - if (!addr) - { - fprintf (stderr, "SIS driver : out of video memory\n"); - sis_fatal_error (); - return; - } + do{ + addr = sis_alloc_fb (hwcx, size, &area->free); + area->memType = VIDEO_TYPE; + if(addr) break; + + /* TODO: swap to agp memory*/ + /* video memory allocation fails */ + addr = sis_alloc_agp(hwcx, size, &area->free); + area->memType = AGP_TYPE; + if(addr) break; + + /* TODO: swap to system memory */ + } + while(0); + + if (!addr){ + fprintf (stderr, "SIS driver : out of video/agp memory\n"); + sis_fatal_error (); + return; + } area->Data = (GLbyte *) ALIGNMENT ((GLuint) addr, TEXTURE_HW_ALIGNMENT); area->Pitch = image->Width * texel_size; @@ -440,7 +500,16 @@ sis_free_texture_image (GLtextureImage * image) return; if (area->Data) - sis_free (hwcx, area->pArea); + switch(area->memType){ + case VIDEO_TYPE: + sis_free_fb (hwcx, area->free); + break; + case AGP_TYPE: + sis_free_agp (hwcx, area->free); + break; + default: + assert(0); + } free (area); image->DriverData = NULL; diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_clear.c b/xc/lib/GL/mesa/src/drv/sis/sis_clear.c index 5d5208628..86240b1b4 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_clear.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_clear.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_clear.c,v 1.3 2000/08/04 03:51:41 tsi Exp $ */ + #include "sis_ctx.h" #include "sis_mesa.h" #include "sis_lock.h" @@ -47,7 +49,7 @@ sis_Clear (GLcontext * ctx, GLbitfield mask, GLboolean all, * differs from current draw buffer */ - if ((xm_buffer->xm_visual->gl_visual->StencilBits && + if ((ctx->Visual->StencilBits && ((mask | GL_DEPTH_BUFFER_BIT) ^ (mask | GL_STENCIL_BUFFER_BIT))) || (*(DWORD *) (ctx->Color.ColorMask) != 0xffffffff) ) @@ -63,7 +65,7 @@ sis_Clear (GLcontext * ctx, GLbitfield mask, GLboolean all, } if (mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) { - if (xm_buffer->gl_buffer->DepthBuffer) + if (xm_buffer->depthbuffer) sis_clear_z_stencil_buffer (ctx, mask, x1, y1, width1, height1); mask &= ~(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } @@ -127,9 +129,9 @@ sis_3D_Clear (GLcontext * ctx, GLbitfield mask, bClrColor = 0; bClrDepth = (mask & GL_DEPTH_BUFFER_BIT) && - (xmesa->xm_visual->gl_visual->DepthBits); + (ctx->Visual->DepthBits); bClrStencil = (mask & GL_STENCIL_BUFFER_BIT) && - (xmesa->xm_visual->gl_visual->StencilBits); + (ctx->Visual->StencilBits); /* update HW state */ /* TODO: if enclosing sis_Clear by sis_RenderStart and sis_RenderEnd is @@ -435,12 +437,12 @@ sis_clear_z_stencil_buffer (GLcontext * ctx, GLbitfield mask, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - GLframebuffer *buffer = ctx->DrawBuffer; + XMesaBuffer xm_buffer = xmesa->xm_buffer; sisBufferInfo *priv = (sisBufferInfo *) xmesa->xm_buffer->private; /* TODO: check write mask */ - if (!buffer->DepthBuffer) + if (!xm_buffer->depthbuffer) return; /* TODO: consider alignment of width, height? */ @@ -554,17 +556,22 @@ sis_swap_buffers (XMesaBuffer b) /* frame control */ /* TODO: need lock? */ - while((*hwcx->FrameCountPtr) - *(DWORD *)(hwcx->IOBase+0x8a2c) + +#if 1 + while((*hwcx->FrameCountPtr) - *(DWORD volatile *)(hwcx->IOBase+0x8a2c) > SIS_MAX_FRAME_LENGTH) { + /* DWORD temp = *(DWORD *)(hwcx->IOBase+0x8a2c); + */ } +#endif LOCK_HARDWARE (); - + + sis_swap_image (b, b->frontbuffer, b->backimage); *(DWORD *)(hwcx->IOBase+0x8a2c) = *hwcx->FrameCountPtr; (*hwcx->FrameCountPtr)++; - sis_swap_image (b, b->frontbuffer, b->backimage); UNLOCK_HARDWARE (); } diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_common.h b/xc/lib/GL/mesa/src/drv/sis/sis_common.h index 45002d14f..a492bd24b 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_common.h +++ b/xc/lib/GL/mesa/src/drv/sis/sis_common.h @@ -1,9 +1,17 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #ifndef _sis_common_h_ #define _sis_common_h_ #include "types.h" #include "sis_xmesaP.h" +#if 0 +#define free(x) +#define calloc(x,y) sis_debug_malloc((x)*(y)) +extern void *sis_debug_malloc(int x); +#endif + #if defined(SIS_DUMP) #include "sis_debug.h" #endif @@ -47,10 +55,8 @@ typedef int INT; typedef long LONG; typedef DWORD *LPDWORD; -/* - * BitBlt Commands - */ -#define Index_SR_Misc_Ctrl11 0x3e +/* BitBlt Commands */ +#define Index_SR_Misc_Ctrl11 0x3e #define CMD0_DD_ENABLE 0x06 #define CMD0_SRC_VIDEO 0x00 #define CMD0_SRC_CPU 0x10 @@ -121,20 +127,22 @@ typedef struct } ENGPACKET, *LPENGPACKET; -/* - * Hardware Info - */ +/* Hardware Info */ #include "sis_reg.h" #include "sis_init.h" typedef struct gl_texture_object GLtextureObject; typedef struct gl_texture_image GLtextureImage; +#define VIDEO_TYPE 0 +#define AGP_TYPE 1 + typedef struct sis_texure_area { GLbyte *Data; GLenum Format; - void *pArea; + void *free; + GLuint memType; GLuint Pitch; GLuint Size; GLuint texelSize; diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h b/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h index d8d49abe0..f225fc0cf 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h +++ b/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.h,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #ifndef _sis_ctx_h_ #define _sis_ctx_h_ @@ -222,6 +224,7 @@ __GLSiScontext; /* Macros to access hwcx */ #define GET_IOBase(x) ((x)->IOBase) #define GET_FbBase(x) ((x)->FbBase) +#define GET_AGPBase(x) ((x)->AGPBase) #define GET_DEPTH(x) ((x)->bytesPerPixel) #define GET_WIDTH(x) ((x)->displayWidth) #define GET_PITCH(x) ((x)->pitch) diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_debug.c b/xc/lib/GL/mesa/src/drv/sis/sis_debug.c index e472f38ee..3d9c21012 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_debug.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_debug.c @@ -1,5 +1,7 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.c,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + /* - * dump HW states, set environment variable SIS_DE1BUG + * dump HW states, set environment variable SIS_DEBUG * to enable these functions */ @@ -9,7 +11,7 @@ #include "sis_ctx.h" #include "sis_mesa.h" -/* for SiS 300 */ +/* for SiS 300/630/540 */ #define MMIOLength (0x8FFF-0x8800+1) #define MMIO3DOffset (0x8800) #define FILE_NAME "300.dump" @@ -21,8 +23,6 @@ int prevLockLine = 0; DWORD _empty[0x10000]; -//#if defined(DEBUG) - void dump_agp (void *addr, int dword_count) { @@ -123,16 +123,3 @@ dvidmem (unsigned char *addr, int size) close (fh); } } - -/* -#else - -#define dump_agp(a,b) do{}while(0) -#define d2f() do{}while(0) -#define d2f_once(a) do{}while(0) -#define void d2f(a) do{}while(0) -#define void d2h(a) do{}while(0) -#define dvidmem(a,b) do{}while(0) - -#endif -*/
\ No newline at end of file diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h b/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h index d85be4176..28f5007c0 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h +++ b/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #define SIS_TRI_FUNC 0 #define SIS_MMIO_WRITE_VERTEX(v, i) \ @@ -16,16 +18,16 @@ { \ if(SIS_TRI_FUNC){ \ MMIOBase[(REG_3D_TSZa+(i)*0x30)/4] = \ - (VB->Win.data[v][2] + ctx->PolygonZoffset) / 65535.0; \ + (VB->Win.data[v][2] + ctx->PolygonZoffset) / SIS_DEPTH_SCALE; \ } \ else{ \ MMIOBase[(REG_3D_TSZa+(i)*0x30)/4] = \ - (VB->Win.data[v][2] + ctx->LineZoffset) / 65535.0; \ + (VB->Win.data[v][2] + ctx->LineZoffset) / SIS_DEPTH_SCALE; \ } \ } \ else \ { \ - MMIOBase[(REG_3D_TSZa+(i)*0x30)/4] = VB->Win.data[v][2] / 65535.0; \ + MMIOBase[(REG_3D_TSZa+(i)*0x30)/4] = VB->Win.data[v][2] / SIS_DEPTH_SCALE; \ } \ \ if (SIS_STATES & SIS_TEXTURE0) \ @@ -142,14 +144,14 @@ AGP_CurrentPtr[1] = Y_FLIP (VB->Win.data[v][1]) + 0.5; \ \ if (ctx->TriangleCaps & DD_TRI_OFFSET){ \ if(SIS_TRI_FUNC){ \ - AGP_CurrentPtr[2] = (VB->Win.data[v][2] + ctx->PolygonZoffset) / 65535.0; \ + AGP_CurrentPtr[2] = (VB->Win.data[v][2] + ctx->PolygonZoffset) / SIS_DEPTH_SCALE; \ } \ else{ \ - AGP_CurrentPtr[2] = (VB->Win.data[v][2] + ctx->LineZoffset) / 65535.0; \ + AGP_CurrentPtr[2] = (VB->Win.data[v][2] + ctx->LineZoffset) / SIS_DEPTH_SCALE; \ } \ } \ else{ \ - AGP_CurrentPtr[2] = VB->Win.data[v][2] / 65535.0; \ + AGP_CurrentPtr[2] = VB->Win.data[v][2] / SIS_DEPTH_SCALE; \ }\ AGP_CurrentPtr+=3; \ if (SIS_STATES & (SIS_USE_W)) \ diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c index 7e91e5fd2..ca09b153f 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_mesa.c,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #include "sis_ctx.h" #include "sis_mesa.h" #include "sis_lock.h" @@ -43,7 +45,9 @@ sis_RenderStart (GLcontext * ctx) sis_StartAGP (ctx); } - /* d2f_once (ctx); */ +#if defined(SIS_DUMP) + d2f_once (ctx); +#endif } void @@ -168,7 +172,7 @@ sis_init_driver (GLcontext * ctx) ctx->Driver.Bitmap = sis_Bitmap; /* Optimization */ -#if NOT_DONE +#ifdef NOT_DONE ctx->Driver.RasterSetup = sis_ChooseRasterSetupFunc(ctx); ctx->Driver.RegisterVB = sis_RegisterVB; ctx->Driver.UnregisterVB = sis_UnregisterVB; @@ -293,7 +297,7 @@ sis_UpdateState (GLcontext * ctx) } } -#if NOT_DONE +#ifdef NOT_DONE sis_set_render_vb_tabs(ctx); #endif @@ -645,7 +649,6 @@ sis_DepthMask (GLcontext * ctx, GLboolean flag) __GLSiSHardware *prev = &hwcx->prev; __GLSiSHardware *current = &hwcx->current; - /* TODO, in xfree 3.9.18, no ctx->Buffer */ if (ctx->Visual->StencilBits) { if (flag || ctx->Stencil.WriteMask) @@ -753,7 +756,7 @@ sis_Enable (GLcontext * ctx, GLenum cap, GLboolean state) #endif break; case GL_DEPTH_TEST: - if (state && xmesa->xm_buffer->gl_buffer->DepthBuffer) + if (state && xmesa->xm_buffer->depthbuffer) { current->hwCapEnable |= MASK_ZTestEnable; } @@ -1093,7 +1096,7 @@ sis_ColorMask (GLcontext * ctx, if (rmask & gmask & bmask & - (!xmesa->xm_visual->gl_visual->AlphaBits | amask)) + (!ctx->Visual->AlphaBits | amask)) { current->hwCapEnable2 &= ~(MASK_AlphaMaskWriteEnable | MASK_ColorMaskWriteEnable); @@ -1354,7 +1357,7 @@ sis_update_drawable_state (GLcontext * ctx) current->hwZ &= ~MASK_ZBufferPitch; current->hwZ |= xm_buffer->width * z_depth >> 2; /* TODO, in xfree 3.9.18, no ctx->Buffer */ - current->hwOffsetZ = ((DWORD) (ctx->DrawBuffer->DepthBuffer) - + current->hwOffsetZ = ((DWORD) (xm_buffer->depthbuffer) - (DWORD) GET_FbBase (hwcx)) >> 2; if ((current->hwOffsetZ ^ prev->hwOffsetZ) @@ -1422,7 +1425,7 @@ sis_GetBufferSize (GLcontext * ctx, GLuint * width, GLuint * height) &priv->cbClearPacket); } - if (xm_buffer->xm_visual->gl_visual->DepthBits) + if (ctx->Visual->DepthBits) sis_alloc_z_stencil_buffer (ctx); switch (hwcx->zFormat) @@ -1444,7 +1447,7 @@ sis_GetBufferSize (GLcontext * ctx, GLuint * width, GLuint * height) current->hwZ &= ~MASK_ZBufferPitch; current->hwZ |= xm_buffer->width * z_depth >> 2; /* TODO, in xfree 3.9.18, no ctx->Buffer */ - current->hwOffsetZ = ((DWORD) (ctx->DrawBuffer->DepthBuffer) - + current->hwOffsetZ = ((DWORD) (xm_buffer->depthbuffer) - (DWORD) GET_FbBase (hwcx)) >> 2; if ((current->hwOffsetZ ^ prev->hwOffsetZ) diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_render.c b/xc/lib/GL/mesa/src/drv/sis/sis_render.c index 558f8d040..f59e4be2e 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_render.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_render.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_render.c,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #include "sis_ctx.h" #include "sis_mesa.h" @@ -9,6 +11,8 @@ #define SIS_USE_Z 0x11 #define SIS_FALLBACK 0x80000000 +#define SIS_DEPTH_SCALE 1.0 + /* * TODO: assert(hwcx->AGPCmdBufSize % AGP_ALLOC_SIZE == 0) * depends on VB_SIZE is better @@ -417,9 +421,10 @@ sis_set_render_func (GLcontext * ctx) hwcx->AGPParseSet &= ~0xffff7000; hwcx->AGPParseSet |= AGPParsingValues[line_index & ~SIS_FALLBACK]; - /* Debug, test sw-render + /* Debug, test sw-render ctx->Driver.LineFunc = NULL; ctx->Driver.TriangleFunc = NULL; + hwcx->swRenderFlag = ~0x0; */ } @@ -470,10 +475,6 @@ sis_FlushAGP (GLcontext * ctx) return; } - /* debug - d2f_once(ctx); - */ - mWait3DCmdQueue (5); mEndPrimitive (); MMIO (REG_3D_AGPCmBase, ((DWORD) AGP_StartPtr - (DWORD) hwcx->AGPCmdBufBase) diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_span.c b/xc/lib/GL/mesa/src/drv/sis/sis_span.c index aa154ed66..fcee409d1 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_span.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_span.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_span.c,v 1.2 2000/08/04 03:51:42 tsi Exp $ */ + #include "sis_ctx.h" #include "sis_mesa.h" @@ -12,7 +14,7 @@ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; \ GLuint pitch = hwcx->swRenderPitch; \ - char *buf = hwcx->swRenderBase + char *buf = (char *)hwcx->swRenderBase #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_texture.c b/xc/lib/GL/mesa/src/drv/sis/sis_texture.c index 75ca83186..eb9042563 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_texture.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_texture.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_texture.c,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #include "sis_ctx.h" #include "sis_mesa.h" @@ -151,7 +153,7 @@ sis_TexImage (GLcontext * ctx, GLenum target, if (area->Format == GL_RGB8) { int i; - GLbyte *src = image->Data; + GLbyte *src = (GLbyte *)image->Data; GLbyte *dst = area->Data; for (i = 0; i < area->Size / 4; i++) @@ -201,7 +203,7 @@ sis_TexSubImage (GLcontext * ctx, GLenum target, if (area->Format == GL_RGB8) { - src = image->Data + (xoffset + yoffset * image->Width) * 3; + src = (GLbyte *)image->Data + (xoffset + yoffset * image->Width) * 3; dst = area->Data + (xoffset + yoffset * image->Width) * 4; soffset = (image->Width - width) * 3; doffset = (image->Width - width) * 4; @@ -222,7 +224,7 @@ sis_TexSubImage (GLcontext * ctx, GLenum target, GLuint texelSize = area->texelSize; GLuint copySize = texelSize * width; - src = image->Data + (xoffset + yoffset * image->Width) * texelSize; + src = (GLbyte *)image->Data + (xoffset + yoffset * image->Width) * texelSize; dst = area->Data + (xoffset + yoffset * image->Width) * texelSize; soffset = image->Width * texelSize; @@ -737,11 +739,23 @@ sis_set_texobj_parm (GLcontext * ctx, GLtextureObject * object, int hw_unit) for (i = 0; i < TxLevel + 1; i++) { - SIStextureArea *area = - (SIStextureArea *) object->Image[i]->DriverData; - GLuint texOffset = ((GLuint) area->Data - (GLuint) GET_FbBase (hwcx)); + SIStextureArea *area = (SIStextureArea *) object->Image[i]->DriverData; + GLuint texOffset; GLuint texPitch = TransferTexturePitch (area->Pitch); + switch(area->memType){ + case VIDEO_TYPE: + texOffset = ((GLuint) area->Data - (GLuint) GET_FbBase (hwcx)); + break; + case AGP_TYPE: + texOffset = ((GLuint) area->Data - (GLuint) GET_AGPBase (hwcx) + + (GLuint) hwcx->AGPAddr); + current->texture[hw_unit].hwTextureMip |= (0x40000 << i); + break; + default: + assert(0); + } + switch (i) { case 0: diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c index 7cce3e68b..1dd01a51a 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c @@ -1,3 +1,5 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ + #include <unistd.h> #include <sys/mman.h> #include "sis_dri.h" @@ -13,6 +15,18 @@ #include "vbxform.h" #include "types.h" +#if 0 +void *sis_debug_malloc(x){ + static char buf[2000000]; + static int count = 0; + void *retval; + + retval = &(buf[count]); + count += x; + return retval; +} +#endif + static XMesaContext XMesa = NULL; /* Current X/Mesa context pointer */ #ifndef SIS_VERBOSE @@ -171,6 +185,11 @@ GLboolean XMesaCreateContext(Display *dpy, GLvisual *mesaVis, driContextPriv->driverPrivate = (void *) c; + /* TODO, to make VB->Win.data[][2] ranges 0 - 1.0 */ + /* Fixme, software render, z span seems all 0 */ + mesaVis->DepthMax = 1; + mesaVis->DepthMaxF = 1.0f; + return GL_TRUE; } @@ -226,21 +245,11 @@ static XMesaBuffer SISCreateWindowBuffer ( Display *dpy, return NULL; b->xm_context = NULL; - b->xm_visual = xmesa->xm_visual; b->display = dpy; - - if (mesaVis->DBflag) - { - b->db_state = BACK_XIMAGE; - } - else - { - b->db_state = 0; - } - + b->pixmap_flag = GL_FALSE; + b->db_state = mesaVis->DBflag; b->gl_buffer = driDrawPriv->mesaBuffer; - b->frontbuffer = driDrawPriv->draw; /* set 0 for buffer update */ @@ -315,7 +324,7 @@ static void SISDestroyBuffer (XMesaBuffer b) #endif } - if (b->gl_buffer->DepthBuffer) + if (b->depthbuffer) { sis_free_z_stencil_buffer (b); } diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h b/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h index 7fcc026e8..f7e5b667a 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h +++ b/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h @@ -1,4 +1,3 @@ - /* * Mesa 3-D graphics library * Version: 3.3 @@ -22,7 +21,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h,v 1.3 2000/08/04 03:51:42 tsi Exp $ */ #ifndef XMESAP_H #define XMESAP_H @@ -35,9 +34,6 @@ # ifdef GLX_DIRECT_RENDERING # include "dri_mesa.h" # endif -# ifdef USE_XSHM -# include <X11/extensions/XShm.h> -# endif #endif #ifdef XFree86Server @@ -53,11 +49,6 @@ typedef struct xmesa_buffer *XMesaBuffer; #endif #include "types.h" -#if defined(FX) && !defined(GLX_DIRECT_RENDERING) -#include "GL/fxmesa.h" -#include "../FX/fxdrv.h" -#endif - #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) # include "xdriP.h" @@ -67,76 +58,12 @@ typedef struct xmesa_buffer *XMesaBuffer; # define DRI_CTX_ARG #endif - -/* for PF_8R8G8B24 pixel format */ -typedef struct { - GLubyte b; - GLubyte g; - GLubyte r; -} bgr_t; - - -/* Function pointer for clearing color buffers */ -typedef void (*clear_func)( GLcontext *ctx, - GLboolean all, GLint x, GLint y, - GLint width, GLint height ); - - -/* - * "Derived" from gl_visual. Basically corresponds to an XVisualInfo. - */ struct xmesa_visual { GLvisual *gl_visual; /* Device independent visual parameters */ XMesaDisplay *display; /* The X11 display */ -#ifdef XFree86Server - GLint screen_depth; /* The depth of the screen */ -#else - XVisualInfo *vishandle; /* The pointer returned by glXChooseVisual */ -#endif XMesaVisualInfo visinfo; /* X's visual info */ - GLint BitsPerPixel; /* True bits per pixel for XImages */ - - GLint level; /* 0=normal, 1=overlay, etc */ - GLint VisualCaveat; /* for GLX_EXT_visual_rating extension */ - - GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ - - GLuint dithered_pf; /* Pixel format when dithering */ - GLuint undithered_pf; /* Pixel format when not dithering */ - - GLfloat RedGamma; /* Gamma values, 1.0 is default */ - GLfloat GreenGamma; - GLfloat BlueGamma; - - GLint rmult, gmult, bmult; /* Range of color values */ - GLint index_bits; /* Bits per pixel in CI mode */ - - /* For PF_TRUECOLOR */ - GLint rshift, gshift, bshift;/* Pixel color component shifts */ - GLubyte Kernel[16]; /* Dither kernel */ - unsigned long RtoPixel[512]; /* RGB to pixel conversion */ - unsigned long GtoPixel[512]; - unsigned long BtoPixel[512]; - GLubyte PixelToR[256]; /* Pixel to RGB conversion */ - GLubyte PixelToG[256]; - GLubyte PixelToB[256]; - - /* For PF_HPCR */ - short hpcr_rgbTbl[3][256]; - GLboolean hpcr_clear_flag; - GLubyte hpcr_clear_ximage_pattern[2][16]; - XMesaImage *hpcr_clear_ximage; - XMesaPixmap hpcr_clear_pixmap; - - /* For PF_1BIT */ - int bitFlip; }; - - -/* - * "Derived" from gl_context. Basically corresponds to a GLXContext. - */ struct xmesa_context { GLcontext *gl_ctx; /* the core library context */ XMesaVisual xm_visual; /* Describes the buffers */ @@ -145,30 +72,15 @@ struct xmesa_context { GLboolean use_read_buffer; /* read from the xm_read_buffer/ */ XMesaDisplay *display; /* == xm_visual->display */ - GLboolean swapbytes; /* Host byte order != display byte order? */ - GLboolean direct; /* Direct rendering context? */ - - GLuint pixelformat; /* Current pixel format */ - - GLubyte red, green, blue, alpha; /* current drawing color */ - unsigned long pixel; /* current drawing pixel value */ - - GLubyte clearcolor[4]; /* current clearing color */ - unsigned long clearpixel; /* current clearing pixel value */ #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) __DRIcontextPrivate *driContextPriv; /* back pointer to DRI context * used for locking */ - void *private; /* device-specific private context */ #endif + void *private; /* device-specific private context */ }; - - -/* - * "Derived" from gl_buffer. Basically corresponds to a GLXDrawable. - */ struct xmesa_buffer { GLboolean wasCurrent; /* was ever the current buffer? */ GLframebuffer *gl_buffer; /* depth, stencil, accum, etc buffers */ @@ -178,380 +90,25 @@ struct xmesa_buffer { XMesaDisplay *display; GLboolean pixmap_flag; /* is the buffer a Pixmap? */ XMesaDrawable frontbuffer; /* either a window or pixmap */ - XMesaPixmap backpixmap; /* back buffer Pixmap */ XMesaImage *backimage; /* back buffer simulated XImage */ - XMesaDrawable buffer; /* the current buffer, either equal to */ - /* frontbuffer, backpixmap or XIMAGE (None) */ - - XMesaColormap cmap; /* the X colormap */ - - GLint db_state; /* 0 = single buffered */ - /* BACK_PIXMAP = use Pixmap for back buffer */ - /* BACK_XIMAGE = use XImage for back buffer */ - -#ifndef XFree86Server - GLuint shm; /* X Shared Memory extension status: */ - /* 0 = not available */ - /* 1 = XImage support available */ - /* 2 = Pixmap support available too */ -#ifdef USE_XSHM - XShmSegmentInfo shminfo; -#endif -#endif - - XMesaImage *rowimage; /* Used for optimized span writing */ + GLvoid *depthbuffer; + + GLboolean db_state; /* GL_FALSE = single buffered */ GLuint width, height; /* size of buffer */ GLint bottom; /* used for FLIP macro below */ - GLubyte *ximage_origin1; /* used for PIXELADDR1 macro */ - GLint ximage_width1; - GLushort *ximage_origin2; /* used for PIXELADDR2 macro */ - GLint ximage_width2; - GLubyte *ximage_origin3; /* used for PIXELADDR3 macro */ - GLint ximage_width3; - GLuint *ximage_origin4; /* used for PIXELADDR4 macro */ - GLint ximage_width4; - - XMesaPixmap stipple_pixmap; /* For polygon stippling */ - XMesaGC stipple_gc; /* For polygon stippling */ - - XMesaGC gc1; /* GC for infrequent color changes */ - XMesaGC gc2; /* GC for frequent color changes */ - XMesaGC cleargc; /* GC for clearing the color buffer */ - - /* The following are here instead of in the XMesaVisual - * because they depend on the window's colormap. - */ - - /* For PF_DITHER, PF_LOOKUP, PF_GRAYSCALE */ - unsigned long color_table[576]; /* RGB -> pixel value */ - - /* For PF_DITHER, PF_LOOKUP, PF_GRAYSCALE */ - GLubyte pixel_to_r[65536]; /* pixel value -> red */ - GLubyte pixel_to_g[65536]; /* pixel value -> green */ - GLubyte pixel_to_b[65536]; /* pixel value -> blue */ - - /* Used to do XAllocColor/XFreeColors accounting: */ - int num_alloced; - unsigned long alloced_colors[256]; #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) __DRIdrawablePrivate *driDrawPriv; /* back pointer to DRI drawable * used for direct access to framebuffer */ - void *private; /* device-specific private drawable */ -#endif - -#if defined( FX ) && !defined(GLX_DIRECT_RENDERING) - /* For 3Dfx Glide only */ - GLboolean FXisHackUsable; /* Can we render into window? */ - GLboolean FXwindowHack; /* Are we rendering into a window? */ - fxMesaContext FXctx; #endif - /* functions for clearing the front and back color buffers */ - clear_func front_clear_func; - clear_func back_clear_func; - - struct xmesa_buffer *Next; /* Linked list pointer: */ -}; - - - -/* Values for xmesa->dest: */ -#define FRONT_PIXMAP 1 -#define BACK_PIXMAP 2 -#define BACK_XIMAGE 4 - - -/* Values for xmesa->pixelformat: */ -#define PF_INDEX 1 /* Color Index mode */ -#define PF_TRUECOLOR 2 /* TrueColor or DirectColor, any depth */ -#define PF_TRUEDITHER 3 /* TrueColor with dithering */ -#define PF_8A8B8G8R 4 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */ -#define PF_8R8G8B 5 /* 32-bit TrueColor: 8-R, 8-G, 8-B bits */ -#define PF_5R6G5B 6 /* 16-bit TrueColor: 5-R, 6-G, 5-B bits */ -#define PF_DITHER 7 /* Color-mapped RGB with dither */ -#define PF_LOOKUP 8 /* Color-mapped RGB without dither */ -#define PF_HPCR 9 /* HP Color Recovery (ad@lms.be 30/08/95) */ -#define PF_1BIT 10 /* monochrome dithering of RGB */ -#define PF_GRAYSCALE 11 /* Grayscale or StaticGray */ -#define PF_8R8G8B24 12 /* 24-bit TrueColor: 8-R, 8-G, 8-B bits */ -#define PF_DITHER_5R6G5B 13 /* 16-bit dithered TrueColor: 5-R, 6-G, 5-B */ - - -/* - * If pixelformat==PF_TRUECOLOR: - */ -#define PACK_TRUECOLOR( PIXEL, R, G, B ) \ - PIXEL = xmesa->xm_visual->RtoPixel[R] \ - | xmesa->xm_visual->GtoPixel[G] \ - | xmesa->xm_visual->BtoPixel[B]; \ - - -/* - * If pixelformat==PF_TRUEDITHER: - */ -#define PACK_TRUEDITHER( PIXEL, X, Y, R, G, B ) \ -{ \ - int d = xmesa->xm_visual->Kernel[((X)&3) | (((Y)&3)<<2)]; \ - PIXEL = xmesa->xm_visual->RtoPixel[(R)+d] \ - | xmesa->xm_visual->GtoPixel[(G)+d] \ - | xmesa->xm_visual->BtoPixel[(B)+d]; \ -} - - - -/* - * If pixelformat==PF_8A8B8G8R: - */ -#define PACK_8A8B8G8R( R, G, B, A ) \ - ( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) ) - - -/* - * Like PACK_8A8B8G8R() but don't use alpha. This is usually an acceptable - * shortcut. - */ -#define PACK_8B8G8R( R, G, B ) ( ((B) << 16) | ((G) << 8) | (R) ) - - - -/* - * If pixelformat==PF_8R8G8B: - */ -#define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) ) - - -/* - * If pixelformat==PF_5R6G5B: - */ -#define PACK_5R6G5B( R, G, B) ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) ) - - - - -/* - * If pixelformat==PF_DITHER: - * - * Improved 8-bit RGB dithering code contributed by Bob Mercier - * (mercier@hollywood.cinenet.net). Thanks Bob! - */ -#undef _R -#undef _G -#undef _B -#undef _D -#ifdef DITHER666 -# define _R 6 -# define _G 6 -# define _B 6 -# define _MIX(r,g,b) (((r)*_G+(g))*_B+(b)) -#else -# define _R 5 -# define _G 9 -# define _B 5 -# define _MIX(r,g,b) ( ((g)<<6) | ((b)<<3) | (r) ) -#endif -#define _DX 4 -#define _DY 4 -#define _D (_DX*_DY) - -/*#define _DITH(C,c,d) (((unsigned)((_D*(C-1)+1)*c+d))/(_D*256))*/ -#define _DITH(C,c,d) (((unsigned)((_D*(C-1)+1)*c+d)) >> 12) - -#define MAXC 256 -static int kernel8[_DY*_DX] = { - 0 * MAXC, 8 * MAXC, 2 * MAXC, 10 * MAXC, - 12 * MAXC, 4 * MAXC, 14 * MAXC, 6 * MAXC, - 3 * MAXC, 11 * MAXC, 1 * MAXC, 9 * MAXC, - 15 * MAXC, 7 * MAXC, 13 * MAXC, 5 * MAXC, -}; -/*static int __d;*/ - -/* Dither for random X,Y */ -#define DITHER_SETUP \ - int __d; \ - unsigned long *ctable = xmesa->xm_buffer->color_table; - -#define DITHER( X, Y, R, G, B ) \ - (__d = kernel8[(((Y)&3)<<2) | ((X)&3)], \ - ctable[_MIX(_DITH(_R, (R), __d), \ - _DITH(_G, (G), __d), \ - _DITH(_B, (B), __d))]) - -/* Dither for random X, fixed Y */ -#define XDITHER_SETUP(Y) \ - int __d; \ - unsigned long *ctable = xmesa->xm_buffer->color_table; \ - int *kernel = &kernel8[ ((Y)&3) << 2 ]; - -#define XDITHER( X, R, G, B ) \ - (__d = kernel[(X)&3], \ - ctable[_MIX(_DITH(_R, (R), __d), \ - _DITH(_G, (G), __d), \ - _DITH(_B, (B), __d))]) - - - -/* - * Dithering for flat-shaded triangles. Precompute all 16 possible - * pixel values given the triangle's RGB color. Contributed by Martin Shenk. - */ -static GLushort DitherValues[16]; /* array of (up to) 16-bit pixel values */ - -#define FLAT_DITHER_SETUP( R, G, B ) \ - { \ - unsigned long *ctable = xmesa->xm_buffer->color_table; \ - int msdr = (_D*((_R)-1)+1) * (R); \ - int msdg = (_D*((_G)-1)+1) * (G); \ - int msdb = (_D*((_B)-1)+1) * (B); \ - int i; \ - for (i=0;i<16;i++) { \ - int k = kernel8[i]; \ - int j = _MIX( (msdr+k)>>12, (msdg+k)>>12, (msdb+k)>>12 ); \ - DitherValues[i] = (GLushort) ctable[j]; \ - } \ - } - -#define FLAT_DITHER_ROW_SETUP(Y) \ - GLushort *ditherRow = DitherValues + ( ((Y)&3) << 2); - -#define FLAT_DITHER(X) ditherRow[(X)&3] - - - -/* - * If pixelformat==PF_LOOKUP: - */ -#define _DITH0(C,c) (((unsigned)((_D*(C-1)+1)*c)) >> 12) - -#define LOOKUP_SETUP \ - unsigned long *ctable = xmesa->xm_buffer->color_table - -#define LOOKUP( R, G, B ) \ - ctable[_MIX(_DITH0(_R, (R)), \ - _DITH0(_G, (G)), \ - _DITH0(_B, (B)))] - - + void *private; /* device-specific private drawable */ -/* - * If pixelformat==PF_HPCR: - * - * HP Color Recovery dithering (ad@lms.be 30/08/95) - * HP has on it's 8-bit 700-series computers, a feature called - * 'Color Recovery'. This allows near 24-bit output (so they say). - * It is enabled by selecting the 8-bit TrueColor visual AND - * corresponding colormap (see tkInitWindow) AND doing some special - * dither. - */ -static const short HPCR_DRGB[3][2][16] = { -{ - { 16, -4, 1,-11, 14, -6, 3, -9, 15, -5, 2,-10, 13, -7, 4, -8}, - {-15, 5, 0, 12,-13, 7, -2, 10,-14, 6, -1, 11,-12, 8, -3, 9} -}, -{ - {-11, 15, -7, 3, -8, 14, -4, 2,-10, 16, -6, 4, -9, 13, -5, 1}, - { 12,-14, 8, -2, 9,-13, 5, -1, 11,-15, 7, -3, 10,-12, 6, 0} -}, -{ - { 6,-18, 26,-14, 2,-22, 30,-10, 8,-16, 28,-12, 4,-20, 32, -8}, - { -4, 20,-24, 16, 0, 24,-28, 12, -6, 18,-26, 14, -2, 22,-30, 10} -} + struct xmesa_buffer *Next; /* Linked list pointer: */ }; -#define DITHER_HPCR( X, Y, R, G, B ) \ - ( ((xmesa->xm_visual->hpcr_rgbTbl[0][R] + HPCR_DRGB[0][(Y)&1][(X)&15]) & 0xE0) \ - |(((xmesa->xm_visual->hpcr_rgbTbl[1][G] + HPCR_DRGB[1][(Y)&1][(X)&15]) & 0xE0)>>3) \ - | ((xmesa->xm_visual->hpcr_rgbTbl[2][B] + HPCR_DRGB[2][(Y)&1][(X)&15])>>6) \ - ) - - - -/* - * If pixelformat==PF_1BIT: - */ -static int const kernel1[16] = { - 0*47, 9*47, 4*47, 12*47, /* 47 = (255*3)/16 */ - 6*47, 2*47, 14*47, 8*47, - 10*47, 1*47, 5*47, 11*47, - 7*47, 13*47, 3*47, 15*47 }; - -#define SETUP_1BIT int bitFlip = xmesa->xm_visual->bitFlip -#define DITHER_1BIT( X, Y, R, G, B ) \ - (( ((int)(R)+(int)(G)+(int)(B)) > kernel1[(((Y)&3) << 2) | ((X)&3)] ) ^ bitFlip) - - - -/* - * If pixelformat==PF_GRAYSCALE: - */ -#define GRAY_RGB( R, G, B ) xmesa->xm_buffer->color_table[((R) + (G) + (B))/3] - - - -#define XIMAGE None - - -/* - * Converts a GL window Y coord to an X window Y coord: - */ -#define FLIP(BUFFER, Y) ((BUFFER)->bottom-(Y)) - - -/* - * Return the address of a 1, 2 or 4-byte pixel in the back XImage: - * X==0 is left, Y==0 is bottom. - */ -#define PIXELADDR1( BUFFER, X, Y ) \ - ( (BUFFER)->ximage_origin1 - (Y) * (BUFFER)->ximage_width1 + (X) ) - -#define PIXELADDR2( BUFFER, X, Y ) \ - ( (BUFFER)->ximage_origin2 - (Y) * (BUFFER)->ximage_width2 + (X) ) - -#define PIXELADDR3( BUFFER, X, Y ) \ - ( (bgr_t *) ( (BUFFER)->ximage_origin3 - (Y) * (BUFFER)->ximage_width3 + 3 * (X) )) - -#define PIXELADDR4( BUFFER, X, Y ) \ - ( (BUFFER)->ximage_origin4 - (Y) * (BUFFER)->ximage_width4 + (X) ) - - - -/* - * External functions: - */ - -extern unsigned long -xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLubyte a, - GLuint pixelFormat ); - -extern void xmesa_alloc_back_buffer( XMesaBuffer b ); - -extern void xmesa_update_state( GLcontext *ctx ); - -extern points_func xmesa_get_points_func( GLcontext *ctx ); - -extern line_func xmesa_get_line_func( GLcontext *ctx ); - -extern triangle_func xmesa_get_triangle_func( GLcontext *ctx ); - - -/* XXX this is a hack to implement shared display lists with 3Dfx */ -extern XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, - XMesaWindow w, - XMesaContext c - DRI_DRAWABLE_ARG - ); - -/* - * These are the extra routines required for integration with XFree86. - * None of these routines should be user visible. -KEM - */ -extern void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ); -extern GLboolean XMesaForceCurrent(XMesaContext c); -extern GLboolean XMesaLoseCurrent(XMesaContext c); -extern void XMesaReset( void ); - #endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index fbaeb5b71..416e3e75e 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -1,3 +1,4 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.10 2000/08/04 03:51:44 tsi Exp $ #include <Threads.tmpl> @@ -23,31 +24,31 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL MESA_INCLUDES = -I. -I.. -I../../include -LinkSourceFile(fxclip.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxcliptmp.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxcva.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxcva.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxcvatmp.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxdd.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxddspan.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxddtex.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxdrv.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxfastpath.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxfasttmp.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxglidew.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxglidew.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxpipeline.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxrender.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxsanity.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxsdettmp.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxsetup.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxstripdet.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxtexman.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxtrifuncs.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxtritmp.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxvsetup.c, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxvsetup.h, ../../../../../../extras/Mesa/src/FX) -LinkSourceFile(fxvs_tmp.h, ../../../../../../extras/Mesa/src/FX) +LinkSourceFile(fxclip.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxcliptmp.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxcva.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxcva.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxcvatmp.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxdd.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxddspan.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxddtex.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxdrv.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxfastpath.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxfasttmp.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxglidew.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxglidew.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxpipeline.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxrender.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxsanity.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxsdettmp.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxsetup.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxstripdet.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxtexman.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxtrifuncs.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxtritmp.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxvsetup.c, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxvsetup.h, $(MESASRCDIR)/src/FX) +LinkSourceFile(fxvs_tmp.h, $(MESASRCDIR)/src/FX) DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) \ diff --git a/xc/lib/ICE/ICE-def.cpp b/xc/lib/ICE/ICE-def.cpp index cf494cda3..2461b9123 100644 --- a/xc/lib/ICE/ICE-def.cpp +++ b/xc/lib/ICE/ICE-def.cpp @@ -61,4 +61,6 @@ EXPORTS _IceReadSkip _IceWrite IceListenForWellKnownConnections + _IceTransGetHostname /* $TOG: ICE-def.cpp /main/7 1998/01/04 12:31:53 kaleb $ */ +/* $XFree86: xc/lib/ICE/ICE-def.cpp,v 1.3 2000/08/09 23:40:12 dawes Exp $ */ diff --git a/xc/lib/Imakefile b/xc/lib/Imakefile index f0d83cb4e..780133c5f 100644 --- a/xc/lib/Imakefile +++ b/xc/lib/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/39 1997/02/26 18:09:44 kaleb $ -XCOMM $XFree86: xc/lib/Imakefile,v 3.36 2000/03/01 12:52:01 tsi Exp $ +XCOMM $XFree86: xc/lib/Imakefile,v 3.38 2000/08/09 03:10:59 tsi Exp $ #define IHaveSubdirs #define PassCDebugFlags @@ -55,10 +55,6 @@ XVLIBDIR = Xv XINERAMADIR=Xinerama #endif -#if BuildXantiLibrary -XANTILIBDIR = Xanti -#endif - #if BuildGLXLibrary GLXLIBDIR = GL #endif @@ -105,7 +101,7 @@ LINTSUBDIRS = Xau Xdmcp $(THRSTUBLIBDIR) X11 oldX ICE SM Xext Xt \ $(SSLIBDIR) $(XF86MISCLIBDIR) $(XF86VMLIBDIR) $(XF86DGALIBDIR) \ $(XF86RUSHLIBDIR) Xmu Xpm Xaw $(XAW6LIBDIR) XIE Xi Xtst FS \ PEX5 $(XKBLIBDIR) $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) \ - Xp $(XVLIBDIR) $(XANTILIBDIR) $(GLXLIBDIR) $(DPSLIBDIR) \ + Xp $(XVLIBDIR) $(GLXLIBDIR) $(DPSLIBDIR) \ $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \ $(ZLIBDIR) $(REGEXDIR) #else diff --git a/xc/lib/X11/Font.c b/xc/lib/X11/Font.c index 471cc4cbf..5efa322f0 100644 --- a/xc/lib/X11/Font.c +++ b/xc/lib/X11/Font.c @@ -28,7 +28,7 @@ sale, use or other dealings in this Software without prior written authorization from the X Consortium and the XFree86 Project. */ -/* $XFree86: xc/lib/X11/Font.c,v 1.9 2000/06/13 23:15:47 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Font.c,v 1.10 2000/08/09 23:40:12 dawes Exp $ */ #define NEED_REPLIES #include "Xlibint.h" @@ -39,9 +39,14 @@ authorization from the X Consortium and the XFree86 Project. #ifdef USE_XF86BIGFONT #include <sys/types.h> #ifdef HAS_SHM +#ifndef __CYGWIN__ #include <sys/ipc.h> +#else +#include <sys/cygipc.h> +#endif #include <sys/shm.h> #endif + #include <stdio.h> #include <stdlib.h> #include <X11/extensions/xf86bigfstr.h> diff --git a/xc/lib/X11/X11-def.cpp b/xc/lib/X11/X11-def.cpp index 872fb6adf..9c862e86f 100644 --- a/xc/lib/X11/X11-def.cpp +++ b/xc/lib/X11/X11-def.cpp @@ -1,12 +1,36 @@ +#ifndef __CYGWIN__ LIBRARY X11 +#else +LIBRARY libX11 +#endif VERSION LIBRARY_VERSION EXPORTS +#ifndef __CYGWIN__ _Xdebug_p=_Xdebug CONSTANT _XCreateMutex_fn_p=_XCreateMutex_fn CONSTANT _XFreeMutex_fn_p=_XFreeMutex_fn CONSTANT _XLockMutex_fn_p=_XLockMutex_fn CONSTANT _XUnlockMutex_fn_p=_XUnlockMutex_fn CONSTANT _Xglobal_lock_p=_Xglobal_lock CONSTANT +#else + _Xdebug + _Xsetlocale + _XFlush + _Xlcmbtowc + _Xlcwctomb + _Xlcmbstowcs + _Xlcwcstombs + _Xmbtowc + _Xmblen + _Xwctomb + _Xmbstowcs + _Xwcstombs + _Xwcscpy + _Xwcsncpy + _Xwcslen + _Xwcscmp + _Xwcsncmp +#endif XActivateScreenSaver XAddConnectionWatch XAddExtension @@ -599,14 +623,22 @@ EXPORTS _XDeqAsyncHandler _XEatData _XError +#ifndef __CYGWIN__ _XFlushIt +#endif _XFlushGCCache _XFreeTemp _XGetAsyncData _XGetAsyncReply +#ifdef __CYGWIN__ + _XGetBitsPerPixel + _XGetScanlinePad +#endif _XIOError _XInitImageFuncPtrs +#ifndef __CYGWIN__ _XLockDisplay +#endif _XRead _XReadEvents _XReadPad @@ -620,8 +652,10 @@ EXPORTS _XUnregisterFilter _XUnregisterInternalConnection _XVIDtoVisual +#ifndef __CYGWIN__ _Xthread_init _Xthread_waiter +#endif XkbIgnoreExtension XkbOpenDisplay XkbQueryExtension @@ -807,3 +841,4 @@ EXPORTS XkbUpdateMapFromCore XkbXlibControlsImplemented /* $TOG: X11-def.cpp /main/19 1998/06/16 16:04:58 kaleb $ */ +/* $XFree86: xc/lib/X11/X11-def.cpp,v 1.6 2000/08/09 23:40:12 dawes Exp $ */ diff --git a/xc/lib/X11/XKeysymDB b/xc/lib/X11/XKeysymDB index b43d32e6c..96f68d846 100644 --- a/xc/lib/X11/XKeysymDB +++ b/xc/lib/X11/XKeysymDB @@ -11,7 +11,7 @@ ! suitability of this software for any purpose. It is provided "as is" ! without express or implied warranty. ! -! $XFree86: xc/lib/X11/XKeysymDB,v 3.4 2000/02/10 15:48:28 dawes Exp $ +! $XFree86: xc/lib/X11/XKeysymDB,v 3.5 2000/07/07 00:45:00 dawes Exp $ hpmute_acute :100000A8 hpmute_grave :100000A9 @@ -197,6 +197,7 @@ XeroxPointerButton3 :10070003 XeroxPointerButton4 :10070004 XeroxPointerButton5 :10070005 +! The definitions here should match <X11/XF86keysym.h> XF86ModeLock :1008FF01 XF86Standby :1008FF10 XF86AudioLowerVolume :1008FF11 @@ -210,6 +211,29 @@ XF86HomePage :1008FF18 XF86Mail :1008FF19 XF86Start :1008FF1A XF86Search :1008FF1B +XF86AudioRecord :1008FF1C +XF86Calculator :1008FF1D +XF86Memo :1008FF1E +XF86ToDoList :1008FF1F +XF86Calendar :1008FF20 +XF86PowerDown :1008FF21 +XF86ContrastAdjust :1008FF22 +XF86RockerUp :1008FF23 +XF86RockerDown :1008FF24 +XF86RockerEnter :1008FF25 +XF86Back :1008FF26 +XF86Forward :1008FF27 +XF86Stop :1008FF28 +XF86Refresh :1008FF29 +! 1008FF2A - 1008FF2F are yet to be assigned +XF86Favorites :1008FF30 +XF86AudioPause :1008FF31 +XF86AudioMedia :1008FF32 +XF86MyComputer :1008FF33 +XF86VendorHome :1008FF34 +XF86LightBulb :1008FF35 +XF86Shop :1008FF36 + usldead_acute :100000A8 usldead_grave :100000A9 diff --git a/xc/lib/X11/lcGenConv.c b/xc/lib/X11/lcGenConv.c index 0bbf3eba9..7cdd6f00b 100644 --- a/xc/lib/X11/lcGenConv.c +++ b/xc/lib/X11/lcGenConv.c @@ -35,7 +35,7 @@ * 2000 * Modifier: Ivan Pascal The XFree86 Project */ -/* $XFree86: xc/lib/X11/lcGenConv.c,v 3.14 2000/02/25 18:27:55 dawes Exp $ */ +/* $XFree86: xc/lib/X11/lcGenConv.c,v 3.15 2000/08/09 23:40:12 dawes Exp $ */ /* * A generic locale loader for all kinds of ISO-2022 based codesets. @@ -56,6 +56,10 @@ #define STDCVT #endif +#ifdef __CYGWIN__ +int __mb_cur_max = 1; +#endif + extern void _XlcAddUtf8Converters( #if NeedFunctionPrototypes XLCd diff --git a/xc/lib/Xext/Xext-def.cpp b/xc/lib/Xext/Xext-def.cpp index 112fa2f2f..ad9bb8e14 100644 --- a/xc/lib/Xext/Xext-def.cpp +++ b/xc/lib/Xext/Xext-def.cpp @@ -17,6 +17,19 @@ EXPORTS XShapeQueryExtents XShapeQueryVersion XShapeSelectInput +#if defined(__CYGWIN__) && defined(HAS_SHM) + XShmAttach + XShmCreateImage + XShmCreatePixmap + XShmDetach +;XShmDestroyImage + XShmGetEventBase + XShmGetImage + XShmPixmapFormat + XShmPutImage + XShmQueryExtension + XShmQueryVersion +#endif XSyncAwait XSyncChangeAlarm XSyncChangeCounter @@ -89,6 +102,8 @@ EXPORTS XSecurityFreeXauth XSecurityGenerateAuthorization XSecurityRevokeAuthorization + XLbxQueryExtension + XLbxQueryVersion XagQueryVersion XagCreateAssociation XagCreateEmbeddedApplicationGroup @@ -103,12 +118,14 @@ EXPORTS XcupGetReservedColormapEntries XcupQueryVersion XcupStoreColors +#ifndef __CYGWIN__ XPanoramiXQueryVersion XPanoramiXAllocInfo XPanoramiXGetScreenCount XPanoramiXGetScreenSize XPanoramiXGetState XPanoramiXQueryExtension +#endif DPMSQueryExtension DPMSGetVersion DPMSCapable @@ -122,3 +139,4 @@ EXPORTS XeviQueryVersion XeviGetVisualInfo /* $TOG: Xext-def.cpp /main/10 1998/01/04 12:31:45 kaleb $ */ +/* $XFree86: xc/lib/Xext/Xext-def.cpp,v 1.6 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/xc/lib/Xmu/Xmu-def.cpp b/xc/lib/Xmu/Xmu-def.cpp new file mode 100644 index 000000000..9e2c9d177 --- /dev/null +++ b/xc/lib/Xmu/Xmu-def.cpp @@ -0,0 +1,100 @@ +LIBRARY libXmu +VERSION LIBRARY_VERSION +EXPORTS +XmuAllStandardColormaps +XmuGetAtomName +XmuInternAtom +XmuInternStrings +XmuMakeAtom +XmuNameOfAtom +XmuClientWindow +XmuAddCloseDisplayHook +XmuLookupCloseDisplayHook +XmuRemoveCloseDisplayHook +XmuGetColormapAllocation +XmuCreateColormap +XmuCreatePixmapFromBitmap +XmuCursorNameToIndex +_XmuCCLookupDisplay +XmuConvertStandardSelection +XmuPrintDefaultErrorMessage +XmuSimpleErrorHandler +XmuDeleteStandardColormap +XmuDQAddDisplay +XmuDQCreate +XmuDQDestroy +XmuDQLookupDisplay +XmuDQRemoveDisplay +XmuDistinguishableColors +XmuDistinguishablePixels +XmuDrawLogo +XmuDrawRoundedRectangle +XmuFillRoundedRectangle +_XEditResCheckMessages +_XEditResGet16 +_XEditResGet32 +_XEditResGet8 +_XEditResGetSigned16 +_XEditResGetString8 +_XEditResGetWidgetInfo +_XEditResPut16 +_XEditResPut32 +_XEditResPut8 +_XEditResPutString8 +_XEditResPutWidgetInfo +_XEditResResetStream +XmuRegisterExternalAgent +XmuCvtFunctionToCallback +XmuGetHostname +XmuCreateStippledPixmap +XmuReleaseStippledPixmap +XmuAddInitializer +XmuCallInitializers +XmuLocateBitmapFile +XmuLocatePixmapFile +_XmuStringToBitmapFreeCache +_XmuStringToBitmapInitCache +XmuLookupAPL +XmuLookupArabic +XmuLookupCyrillic +XmuLookupGreek +XmuLookupHebrew +XmuLookupJISX0201 +XmuLookupKana +XmuLookupLatin1 +XmuLookupLatin2 +XmuLookupLatin3 +XmuLookupLatin4 +XmuLookupString +XmuLookupStandardColormap +XmuCompareISOLatin1 +XmuCopyISOLatin1Lowered +XmuCopyISOLatin1Uppered +XmuReadBitmapData +XmuReadBitmapDataFromFile +XmuScreenOfWindow +XmuReshapeWidget +XmuStandardColormap +XmuCvtStringToBackingStore +XmuCvtStringToBitmap +XmuCvtStringToColorCursor +XmuCvtStringToCursor +XmuCvtStringToGravity +XmuCvtStringToJustify +XmuCvtStringToLong +XmuCvtStringToOrientation +XmuCvtStringToShapeStyle +XmuCvtStringToWidget +XmuNewCvtStringToWidget +XmuUpdateMapHints +XmuVisualStandardColormaps +XmuWnCountOwnedResources +XmuWnFetchResources +XmuWnInitializeNodes +XmuWnNameToNode +XctCreate +XctFree +XctNextItem +XctReset + +/* $XFree86: xc/lib/Xmu/Xmu-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/xc/lib/Xp/Xp-def.cpp b/xc/lib/Xp/Xp-def.cpp index 0a13b1580..c8d5050c9 100644 --- a/xc/lib/Xp/Xp-def.cpp +++ b/xc/lib/Xp/Xp-def.cpp @@ -33,8 +33,10 @@ EXPORTS XpSendOneTicket XpSetAttributes XpSetContext + XpSetImageResolution XpSetLocaleHinter XpStartDoc XpStartJob XpStartPage /* $XConsortium: Xp-def.cpp /main/1 1996/11/13 14:44:46 lehors $ */ +/* $XFree86: xc/lib/Xp/Xp-def.cpp,v 1.2 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/xc/lib/Xpm/Xpm-def.cpp b/xc/lib/Xpm/Xpm-def.cpp new file mode 100644 index 000000000..12b86d63e --- /dev/null +++ b/xc/lib/Xpm/Xpm-def.cpp @@ -0,0 +1,39 @@ +LIBRARY Xpm +VERSION LIBRARY_VERSION +EXPORTS + XpmAttributesSize + XpmCreateBufferFromImage + XpmCreateBufferFromPixmap + XpmCreateBufferFromXpmImage + XpmCreateDataFromImage + XpmCreateDataFromPixmap + XpmCreateDataFromXpmImage + XpmCreateImageFromBuffer + XpmCreateImageFromData + XpmCreateImageFromXpmImage + XpmCreatePixmapFromBuffer + XpmCreatePixmapFromData + XpmCreatePixmapFromXpmImage + XpmCreateXpmImageFromBuffer + XpmCreateXpmImageFromData + XpmCreateXpmImageFromImage + XpmCreateXpmImageFromPixmap + XpmFree + XpmFreeAttributes + XpmFreeExtensions + XpmFreeXpmImage + XpmFreeXpmInfo + XpmGetErrorString + XpmLibraryVersion + XpmReadFileToBuffer + XpmReadFileToData + XpmReadFileToImage + XpmReadFileToPixmap + XpmReadFileToXpmImage + XpmWriteFileFromBuffer + XpmWriteFileFromData + XpmWriteFileFromImage + XpmWriteFileFromPixmap + XpmWriteFileFromXpmImage + +/* $XFree86: xc/lib/Xpm/Xpm-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/xc/lib/Xss/Xss-def.cpp b/xc/lib/Xss/Xss-def.cpp new file mode 100644 index 000000000..3aa6839d7 --- /dev/null +++ b/xc/lib/Xss/Xss-def.cpp @@ -0,0 +1,14 @@ +LIBRARY XSS +EXPORTS + XScreenSaverQueryExtension + XScreenSaverQueryVersion + XScreenSaverAllocInfo + XScreenSaverQueryInfo + XScreenSaverSelectInput + XScreenSaverSetAttributes + XScreenSaverUnsetAttributes + XScreenSaverRegister + XScreenSaverUnregister + XScreenSaverGetRegistered + +/* $XFree86: xc/lib/Xss/Xss-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/xc/lib/Xxf86dga/Xxf86dga-def.cpp b/xc/lib/Xxf86dga/Xxf86dga-def.cpp new file mode 100644 index 000000000..7bbd72d2c --- /dev/null +++ b/xc/lib/Xxf86dga/Xxf86dga-def.cpp @@ -0,0 +1,16 @@ +LIBRARY libXxf86dga +EXPORTS + XF86DGAQueryExtension + XF86DGAQueryDirectVideo + XF86DGAQueryVersion + XF86DGAInstallColormap + XF86DGAGetVideoLL + XF86DGADirectVideoLL +; XF86DGAGetViewPort + XF86DGASetViewPort + XF86DGAGetVidPage + XF86DGASetVidPage + XF86DGADirectVideo + XF86DGAGetVideo + +/* $XFree86: xc/lib/Xxf86dga/Xxf86dga-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */ diff --git a/xc/lib/Xxf86misc/Xxf86misc-def.cpp b/xc/lib/Xxf86misc/Xxf86misc-def.cpp new file mode 100644 index 000000000..10f9116b7 --- /dev/null +++ b/xc/lib/Xxf86misc/Xxf86misc-def.cpp @@ -0,0 +1,13 @@ +LIBRARY XXF86MISC +EXPORTS + XF86MiscQueryExtension + XF86MiscQueryVersion + XF86MiscSetKbdSettings + XF86MiscGetKbdSettings + XF86MiscSetMouseSettings + XF86MiscGetMouseSettings +; XF86MiscSetSaver +; XF86MiscGetSaver + + +/* $XFree86: xc/lib/Xxf86misc/Xxf86misc-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */ diff --git a/xc/lib/Xxf86vm/XF86VMode.c b/xc/lib/Xxf86vm/XF86VMode.c index b3b30212e..313a8d63a 100644 --- a/xc/lib/Xxf86vm/XF86VMode.c +++ b/xc/lib/Xxf86vm/XF86VMode.c @@ -1,5 +1,5 @@ /* $XConsortium: XF86VMode.c /main/2 1995/11/14 18:17:58 kaleb $ */ -/* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.27 1999/07/19 13:36:06 dawes Exp $ */ +/* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.28 2000/08/04 16:13:16 eich Exp $ */ /* Copyright (c) 1995 Kaleb S. KEITHLEY @@ -239,18 +239,18 @@ XF86VidModeGetModeLine(dpy, screen, dotclock, modeline) SyncHandle(); return False; } - *dotclock = rep.dotclock; - modeline->hdisplay = rep.hdisplay; - modeline->hsyncstart = rep.hsyncstart; - modeline->hsyncend = rep.hsyncend; - modeline->htotal = rep.htotal; + *dotclock = oldrep.dotclock; + modeline->hdisplay = oldrep.hdisplay; + modeline->hsyncstart = oldrep.hsyncstart; + modeline->hsyncend = oldrep.hsyncend; + modeline->htotal = oldrep.htotal; modeline->hskew = 0; - modeline->vdisplay = rep.vdisplay; - modeline->vsyncstart = rep.vsyncstart; - modeline->vsyncend = rep.vsyncend; - modeline->vtotal = rep.vtotal; - modeline->flags = rep.flags; - modeline->privsize = rep.privsize; + modeline->vdisplay = oldrep.vdisplay; + modeline->vsyncstart = oldrep.vsyncstart; + modeline->vsyncend = oldrep.vsyncend; + modeline->vtotal = oldrep.vtotal; + modeline->flags = oldrep.flags; + modeline->privsize = oldrep.privsize; } else { if (!_XReply(dpy, (xReply *)&rep, (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) { @@ -272,13 +272,13 @@ XF86VidModeGetModeLine(dpy, screen, dotclock, modeline) modeline->privsize = rep.privsize; } - if (rep.privsize > 0) { - if (!(modeline->private = Xcalloc(rep.privsize, sizeof(INT32)))) { - _XEatData(dpy, (rep.privsize) * sizeof(INT32)); + if (modeline->privsize > 0) { + if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) { + _XEatData(dpy, (modeline->privsize) * sizeof(INT32)); Xfree(modeline->private); return False; } - _XRead32(dpy, modeline->private, rep.privsize * sizeof(INT32)); + _XRead32(dpy, modeline->private, modeline->privsize * sizeof(INT32)); } else { modeline->private = NULL; } diff --git a/xc/lib/Xxf86vm/Xxf86vm-def.cpp b/xc/lib/Xxf86vm/Xxf86vm-def.cpp new file mode 100644 index 000000000..9f08eb85f --- /dev/null +++ b/xc/lib/Xxf86vm/Xxf86vm-def.cpp @@ -0,0 +1,16 @@ +LIBRARY XXF86VM +EXPORTS + XF86VidModeQueryExtension + XF86VidModeQueryVersion + XF86VidModeGetModeLine + XF86VidModeGetAllModeLines + XF86VidModeModModeLine + XF86VidModeSwitchMode + XF86VidModeLockModeSwitch + XF86VidModeGetMonitor + XF86VidModeGetGamma + XF86VidModeSetGamma + XF86VidModeSwitchToMode + XF86VidModeAddModeLine + +/* $XFree86: xc/lib/Xxf86vm/Xxf86vm-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */ diff --git a/xc/lib/dps/csconndi.c b/xc/lib/dps/csconndi.c index e617d6985..2550cd396 100644 --- a/xc/lib/dps/csconndi.c +++ b/xc/lib/dps/csconndi.c @@ -47,7 +47,7 @@ * * Author: Adobe Systems Incorporated and MIT X Consortium */ -/* $XFree86: xc/lib/dps/csconndi.c,v 1.3 2000/05/18 23:46:12 dawes Exp $ */ +/* $XFree86: xc/lib/dps/csconndi.c,v 1.4 2000/08/09 23:40:14 dawes Exp $ */ #if defined(sun) && !defined(SVR4) #define memmove(t,f,c) bcopy(f,t,c) @@ -417,7 +417,9 @@ DPSCAPConnect( #include <netinet/tcp.h> #endif /* NO_TCP_H */ #else /* apollo */ +#ifndef __CYGWIN__ #include <netinet/tcp.h> +#endif /* __CYGWIN__ */ #endif /* apollo */ #endif #endif /* NEED_BSDISH */ diff --git a/xc/lib/dps/dps-def.cpp b/xc/lib/dps/dps-def.cpp new file mode 100644 index 000000000..75501a8a7 --- /dev/null +++ b/xc/lib/dps/dps-def.cpp @@ -0,0 +1,991 @@ +LIBRARY Dps +VERSION LIBRARY_VERSION +EXPORTS +DPSAddContextExtensionRec +DPSAwaitReturnValues +DPSBinObjSeqWrite +DPSChainContext +DPSCheckInitClientGlobals +DPSCheckRaiseError +DPSCreateContext +DPSCreateTextContext +DPSDefaultErrorProc +DPSDestroyContext +DPSDestroySpace +DPSFlushContext +DPSGenerateExtensionRecID +DPSGetContextExtensionRec +DPSGetContextType +DPSGetCurrentContext +DPSGetCurrentErrorBackstop +DPSGetCurrentTextBackstop +DPSInitCommonContextProcs +DPSInitCommonSpaceProcs +DPSInitCommonTextContextProcs +DPSInitialize +DPSInterruptContext +DPSKnownContext +DPSKnownSpace +DPSMapNames +DPSNameFromIndex +DPSPrivCurrentContext +DPSRemoveContextExtensionRec +DPSResetContext +DPSSafeSetLastNameIndex +DPSSetAbbrevMode +DPSSetContext +DPSSetErrorBackstop +DPSSetNumStringConversion +DPSSetResultTable +DPSSetTextBackstop +DPSSetWh +DPSSetWrapSynchronization +DPSSuppressBinaryConversion +DPSUnchainContext +DPSUpdateNameMap +DPSWaitContext +DPSWriteData +DPSWriteNumString +DPSWritePostScript +DPSWriteStringChars +DPSWriteTypedObjectArray +DPScalloc +DPSclientPrintProc +DPSPrintf +DPSRaise +DPSCreatePSWDict +DPSDestroyPSWDict +DPSMakeAtom +DPSWDictEnter +DPSWDictLookup +DPSWDictRemove +DPSFetchAbbrevList +DPSGetOperatorAbbrev +DPSGetSysnameAbbrev +DPSCantHappen +DPSChangeEncoding +DPSCheckShared +DPSContextFromContextID +DPSDefaultPrivateHandler +DPSFatalProc +DPSHandleBogusError +DPSInitPrivateContextFields +DPSInitPrivateContextProcs +DPSInitPrivateSpaceFields +DPSInitPrivateTextContextFields +DPSNewUserObjectIndex +DPSPrivateCheckWait +DPSPrivateDestroyContext +DPSPrivateDestroySpace +DPSServicePostScript +DPSWarnProc +DPSinnerProcWriteData +XDPSContextFromSharedID +XDPSContextFromXID +XDPSCreateContext +XDPSCreateSecureContext +XDPSCreateSimpleContext +XDPSDispatchEvent +XDPSFindContext +XDPSGetContextStatus +XDPSGetProtocolVersion +XDPSIsDPSEvent +XDPSIsOutputEvent +XDPSIsReadyEvent +XDPSIsStatusEvent +XDPSNotifyWhenReady +XDPSReadyEventHandler +XDPSRegisterReadyProc +XDPSRegisterStatusProc +XDPSSetEventDelivery +XDPSSetProcs +XDPSSetStatusMask +XDPSSpaceFromSharedID +XDPSSpaceFromXID +XDPSStatusEventHandler +XDPSUnfreezeContext +XDPSXIDFromContext +XDPSXIDFromSpace +DPSInitSysNames +DPSCreatePrivContext +DPSDefaultTextBackstop +DPSIncludePrivContext +DPSInitClient +DPSOutOfMemory +DPSSendDestroySpace +DPSSendEOF +DPSSendInterrupt +DPSSendPostScript +DPSSendTerminate +XDPSCreatePrivContextRec +XDPSForceEvents +XDPSNumFormat +XDPSPrivZapDpy +XDPSSendUnfreeze +XDPSSetContextEncoding +XDPSLCAPNotify +XDPSLCallOutputEventHandler +XDPSLCallReadyEventHandler +XDPSLCallStatusEventHandler +XDPSLCleanAll +XDPSLCleanContext +XDPSLContextFromXID +XDPSLCreateContext +XDPSLCreateContextAndSpace +XDPSLCreateContextFromID +XDPSLCreateSpace +XDPSLDestroySpace +XDPSLDispatchCSDPSFakeEvent +XDPSLFlush +XDPSLFlushGC +XDPSLGetCSDPSFakeEventType +XDPSLGetCSDPSReady +XDPSLGetCSDPSStatus +XDPSLGetCodes +XDPSLGetGCFlushMode +XDPSLGetPassEventsFlag +XDPSLGetShunt +XDPSLGetStatus +XDPSLGetSyncMask +XDPSLGetVersion +XDPSLGetWrapWaitingFlag +XDPSLGiveInput +XDPSLIDFromContext +XDPSLInit +XDPSLInitDisplayFlags +XDPSLNotifyContext +XDPSLNotifyWhenReady +XDPSLReconcileRequests +XDPSLReset +XDPSLSetAfterProc +XDPSLSetAgentArg +XDPSLSetAgentName +XDPSLSetClientMessageHandler +XDPSLSetCodes +XDPSLSetGCFlushMode +XDPSLSetPassEventsFlag +XDPSLSetReadyEventHandler +XDPSLSetShunt +XDPSLSetStatusEventHandler +XDPSLSetStatusMask +XDPSLSetSyncMask +XDPSLSetTextEventHandler +XDPSLSetVersion +XDPSLSetWrapWaitingFlag +XDPSLSync +XDPSLSyncGCClip +XDPSLTestErrorCode +XDPSLUpdateAgentArgs +XDPSSetXtEventDispatching +;XDPSCreateStandardColormaps +XDPSGetDefaultColorMaps +CSDPSHeadOfDpyExt +CSDPSInit +DPSCAPChangeGC +DPSCAPCloseDisplayProc +DPSCAPCopyGCProc +DPSCAPCreate +DPSCAPDestroy +DPSCAPFlushGCProc +DPSCAPFreeGCProc +DPSCAPStartUp +DPSCAPWrite +XDPSFlushGC +XDPSNXSetAgentArg +XDPSReconcileRequests +XDPSSyncGCClip +DPSCAPCloseAgent +DPSCAPOpenAgent +DPSCAPConnect +N_XDisconnectDisplay +N_XWaitForReadable +N_XWaitForWritable +StartXDPSNX +XDPSNXRecommendPort +XDPSGetNXArg +XDPSNXFindNX +XDPSNXSetClientArg +NXProcData +N_XANYSET +N_XFlush +N_XGetHostname +N_XRead +N_XReadPad +N_XReply +N_XSend +N_XUnknownNativeEvent +N_XUnknownWireEvent +DPScolorimage +DPScurrentblackgeneration +DPScurrentcmykcolor +DPScurrentcolorscreen +DPScurrentcolortransfer +DPScurrentundercolorremoval +DPSsetblackgeneration +DPSsetcmykcolor +DPSsetcolorscreen +DPSsetcolortransfer +DPSsetundercolorremoval +DPSeq +DPSexit +DPSfalse +DPSfor +DPSforall +DPSge +DPSgt +DPSif +DPSifelse +DPSle +DPSloop +DPSlt +DPSne +DPSnot +DPSor +DPSrepeat +DPSstop +DPSstopped +DPStrue +DPSUserObjects +DPScondition +DPScurrentcontext +DPScurrentobjectformat +DPSdefineusername +DPSdefineuserobject +DPSdetach +DPSexecuserobject +DPSfork +DPSjoin +DPSlock +DPSmonitor +DPSnotify +DPSsetobjectformat +DPSsetvmthreshold +DPSundefineuserobject +DPSwait +DPSyield +DPSaload +DPSanchorsearch +DPSarray +DPSastore +DPSbegin +DPSclear +DPScleartomark +DPScopy +DPScount +DPScounttomark +DPScvi +DPScvlit +DPScvn +DPScvr +DPScvrs +DPScvs +DPScvx +DPSdef +DPSdict +DPSdictstack +DPSdup +DPSend +DPSexch +DPSexecstack +DPSexecuteonly +DPSget +DPSgetinterval +DPSindex +DPSknown +DPSlength +DPSload +DPSmark +DPSmatrix +DPSmaxlength +DPSnoaccess +DPSnull +DPSpackedarray +DPSpop +DPSput +DPSputinterval +DPSrcheck +DPSreadonly +DPSroll +DPSscheck +DPSsearch +DPSshareddict +DPSstatusdict +DPSstore +DPSstring +DPSstringwidth +DPSsystemdict +DPSuserdict +DPSwcheck +DPSwhere +DPSxcheck +DPSFontDirectory +DPSISOLatin1Encoding +DPSSharedFontDirectory +DPSStandardEncoding +DPScachestatus +DPScurrentcacheparams +DPScurrentfont +DPSdefinefont +DPSfindfont +DPSmakefont +DPSscalefont +DPSselectfont +DPSsetcachedevice +DPSsetcachelimit +DPSsetcacheparams +DPSsetcharwidth +DPSsetfont +DPSundefinefont +DPSconcat +DPScurrentdash +DPScurrentflat +DPScurrentgray +DPScurrentgstate +DPScurrenthalftone +DPScurrenthalftonephase +DPScurrenthsbcolor +DPScurrentlinecap +DPScurrentlinejoin +DPScurrentlinewidth +DPScurrentmatrix +DPScurrentmiterlimit +DPScurrentpoint +DPScurrentrgbcolor +DPScurrentscreen +DPScurrentstrokeadjust +DPScurrenttransfer +DPSdefaultmatrix +DPSgrestore +DPSgrestoreall +DPSgsave +DPSgstate +DPSinitgraphics +DPSinitmatrix +DPSrotate +DPSscale +DPSsetdash +DPSsetflat +DPSsetgray +DPSsetgstate +DPSsethalftone +DPSsethalftonephase +DPSsethsbcolor +DPSsetlinecap +DPSsetlinejoin +DPSsetlinewidth +DPSsetmatrix +DPSsetmiterlimit +DPSsetrgbcolor +DPSsetscreen +DPSsetstrokeadjust +DPSsettransfer +DPStranslate +DPSbytesavailable +DPSclosefile +DPScurrentfile +DPSdeletefile +DPSecho +DPSequals +DPSequalsequals +DPSfile +DPSfilenameforall +DPSfileposition +DPSflush +DPSflushfile +DPSprint +DPSprintobject +DPSpstack +DPSread +DPSreadhexstring +DPSreadline +DPSreadstring +DPSrenamefile +DPSresetfile +DPSsetfileposition +DPSstack +DPSstatus +DPStoken +DPSwrite +DPSwritehexstring +DPSwriteobject +DPSwritestring +DPSabs +DPSadd +DPSand +DPSatan +DPSbitshift +DPSceiling +DPScos +DPSdiv +DPSexp +DPSfloor +DPSidiv +DPSln +DPSlog +DPSmod +DPSmul +DPSneg +DPSround +DPSsin +DPSsqrt +DPSsub +DPStruncate +DPSxor +DPSconcatmatrix +DPSdtransform +DPSidentmatrix +DPSidtransform +DPSinvertmatrix +DPSitransform +DPStransform +DPSbanddevice +DPSframedevice +DPSnulldevice +DPSrenderbands +DPSashow +DPSawidthshow +DPScopypage +DPSeofill +DPSerasepage +DPSfill +DPSimage +DPSimagemask +DPSkshow +DPSrectfill +DPSrectstroke +DPSshow +DPSshowpage +DPSstroke +DPSstrokepath +DPSueofill +DPSufill +DPSustroke +DPSustrokepath +DPSwidthshow +DPSxshow +DPSxyshow +DPSyshow +DPSarc +DPSarcn +DPSarct +DPSarcto +DPScharpath +DPSclip +DPSclippath +DPSclosepath +DPScurveto +DPSeoclip +DPSeoviewclip +DPSflattenpath +DPSinitclip +DPSinitviewclip +DPSlineto +DPSmoveto +DPSnewpath +DPSpathbbox +DPSpathforall +DPSrcurveto +DPSrectclip +DPSrectviewclip +DPSreversepath +DPSrlineto +DPSrmoveto +DPSsetbbox +DPSsetucacheparams +DPSuappend +DPSucache +DPSucachestatus +DPSupath +DPSviewclip +DPSviewclippath +DPSbind +DPScleardictstack +DPScountdictstack +DPScountexecstack +DPScurrentdict +DPScurrentpacking +DPScurrentshared +DPSdeviceinfo +DPSerrordict +DPSexec +DPSprompt +DPSquit +DPSrand +DPSrealtime +DPSrestore +DPSrrand +DPSrun +DPSsave +DPSsetpacking +DPSsetshared +DPSsrand +DPSstart +DPStype +DPSundef +DPSusertime +DPSversion +DPSvmreclaim +DPSvmstatus +DPSineofill +DPSinfill +DPSinstroke +DPSinueofill +DPSinufill +DPSinustroke +DPSwtranslation +DPSgetboolean +DPSgetchararray +DPSgetfloat +DPSgetfloatarray +DPSgetint +DPSgetintarray +DPSgetstring +DPSsendboolean +DPSsendchararray +DPSsendfloat +DPSsendfloatarray +DPSsendint +DPSsendintarray +DPSsendstring +DPSclientXready +DPSclientsync +DPScurrentXdrawingfunction +DPScurrentXgcdrawable +DPScurrentXgcdrawablecolor +DPScurrentXoffset +DPSsetXdrawingfunction +DPSsetXgcdrawable +DPSsetXgcdrawablecolor +DPSsetXoffset +DPSsetXrgbactual +DPSGlobalFontDirectory +DPScshow +DPScurrentcolor +DPScurrentcolorrendering +DPScurrentcolorspace +DPScurrentdevparams +DPScurrentglobal +DPScurrentoverprint +DPScurrentpagedevice +DPScurrentsystemparams +DPScurrentuserparams +DPSdefineresource +DPSexecform +DPSfilter +DPSfindencoding +DPSfindresource +DPSgcheck +DPSglobaldict +DPSglyphshow +DPSlanguagelevel +DPSleftbracket +DPSleftleft +DPSmakepattern +DPSproduct +DPSresourceforall +DPSresourcestatus +DPSrevision +DPSrightbracket +DPSrightright +DPSrootfont +DPSserialnumber +DPSsetcolor +DPSsetcolorrendering +DPSsetcolorspace +DPSsetdevparams +DPSsetglobal +DPSsetoverprint +DPSsetpagedevice +DPSsetpattern +DPSsetsystemparams +DPSsetuserparams +DPSstartjob +DPSundefineresource +PScolorimage +PScurrentblackgeneration +PScurrentcmykcolor +PScurrentcolorscreen +PScurrentcolortransfer +PScurrentundercolorremoval +PSsetblackgeneration +PSsetcmykcolor +PSsetcolorscreen +PSsetcolortransfer +PSsetundercolorremoval +PSeq +PSexit +PSfalse +PSfor +PSforall +PSge +PSgt +PSif +PSifelse +PSle +PSloop +PSlt +PSne +PSnot +PSor +PSrepeat +PSstop +PSstopped +PStrue +PSUserObjects +PScondition +PScurrentcontext +PScurrentobjectformat +PSdefineusername +PSdefineuserobject +PSdetach +PSexecuserobject +PSfork +PSjoin +PSlock +PSmonitor +PSnotify +PSsetobjectformat +PSsetvmthreshold +PSundefineuserobject +PSwait +PSyield +PSaload +PSanchorsearch +PSarray +PSastore +PSbegin +PSclear +PScleartomark +PScopy +PScount +PScounttomark +PScvi +PScvlit +PScvn +PScvr +PScvrs +PScvs +PScvx +PSdef +PSdict +PSdictstack +PSdup +PSend +PSexch +PSexecstack +PSexecuteonly +PSget +PSgetinterval +PSindex +PSknown +PSlength +PSload +PSmark +PSmatrix +PSmaxlength +PSnoaccess +PSnull +PSpackedarray +PSpop +PSput +PSputinterval +PSrcheck +PSreadonly +PSroll +PSscheck +PSsearch +PSshareddict +PSstatusdict +PSstore +PSstring +PSstringwidth +PSsystemdict +PSuserdict +PSwcheck +PSwhere +PSxcheck +PSFontDirectory +PSISOLatin1Encoding +PSSharedFontDirectory +PSStandardEncoding +PScachestatus +PScurrentcacheparams +PScurrentfont +PSdefinefont +PSfindfont +PSmakefont +PSscalefont +PSselectfont +PSsetcachedevice +PSsetcachelimit +PSsetcacheparams +PSsetcharwidth +PSsetfont +PSundefinefont +PSconcat +PScurrentdash +PScurrentflat +PScurrentgray +PScurrentgstate +PScurrenthalftone +PScurrenthalftonephase +PScurrenthsbcolor +PScurrentlinecap +PScurrentlinejoin +PScurrentlinewidth +PScurrentmatrix +PScurrentmiterlimit +PScurrentpoint +PScurrentrgbcolor +PScurrentscreen +PScurrentstrokeadjust +PScurrenttransfer +PSdefaultmatrix +PSgrestore +PSgrestoreall +PSgsave +PSgstate +PSinitgraphics +PSinitmatrix +PSrotate +PSscale +PSsetdash +PSsetflat +PSsetgray +PSsetgstate +PSsethalftone +PSsethalftonephase +PSsethsbcolor +PSsetlinecap +PSsetlinejoin +PSsetlinewidth +PSsetmatrix +PSsetmiterlimit +PSsetrgbcolor +PSsetscreen +PSsetstrokeadjust +PSsettransfer +PStranslate +PSbytesavailable +PSclosefile +PScurrentfile +PSdeletefile +PSecho +PSequals +PSequalsequals +PSfile +PSfilenameforall +PSfileposition +PSflush +PSflushfile +PSprint +PSprintobject +PSpstack +PSread +PSreadhexstring +PSreadline +PSreadstring +PSrenamefile +PSresetfile +PSsetfileposition +PSstack +PSstatus +PStoken +PSwrite +PSwritehexstring +PSwriteobject +PSwritestring +PSabs +PSadd +PSand +PSatan +PSbitshift +PSceiling +PScos +PSdiv +PSexp +PSfloor +PSidiv +PSln +PSlog +PSmod +PSmul +PSneg +PSround +PSsin +PSsqrt +PSsub +PStruncate +PSxor +PSconcatmatrix +PSdtransform +PSidentmatrix +PSidtransform +PSinvertmatrix +PSitransform +PStransform +PSbanddevice +PSframedevice +PSnulldevice +PSrenderbands +PSashow +PSawidthshow +PScopypage +PSeofill +PSerasepage +PSfill +PSimage +PSimagemask +PSkshow +PSrectfill +PSrectstroke +PSshow +PSshowpage +PSstroke +PSstrokepath +PSueofill +PSufill +PSustroke +PSustrokepath +PSwidthshow +PSxshow +PSxyshow +PSyshow +PSarc +PSarcn +PSarct +PSarcto +PScharpath +PSclip +PSclippath +PSclosepath +PScurveto +PSeoclip +PSeoviewclip +PSflattenpath +PSinitclip +PSinitviewclip +PSlineto +PSmoveto +PSnewpath +PSpathbbox +PSpathforall +PSrcurveto +PSrectclip +PSrectviewclip +PSreversepath +PSrlineto +PSrmoveto +PSsetbbox +PSsetucacheparams +PSuappend +PSucache +PSucachestatus +PSupath +PSviewclip +PSviewclippath +PSbind +PScleardictstack +PScountdictstack +PScountexecstack +PScurrentdict +PScurrentpacking +PScurrentshared +PSdeviceinfo +PSerrordict +PSexec +PSprompt +PSquit +PSrand +PSrealtime +PSrestore +PSrrand +PSrun +PSsave +PSsetpacking +PSsetshared +PSsrand +PSstart +PStype +PSundef +PSusertime +PSversion +PSvmreclaim +PSvmstatus +PSineofill +PSinfill +PSinstroke +PSinueofill +PSinufill +PSinustroke +PSwtranslation +PSgetboolean +PSgetchararray +PSgetfloat +PSgetfloatarray +PSgetint +PSgetintarray +PSgetstring +PSsendboolean +PSsendchararray +PSsendfloat +PSsendfloatarray +PSsendint +PSsendintarray +PSsendstring +PSclientXready +PSclientsync +PScurrentXdrawingfunction +PScurrentXgcdrawable +PScurrentXgcdrawablecolor +PScurrentXoffset +PSsetXdrawingfunction +PSsetXgcdrawable +PSsetXgcdrawablecolor +PSsetXoffset +PSsetXrgbactual +PSGlobalFontDirectory +PScshow +PScurrentcolor +PScurrentcolorrendering +PScurrentcolorspace +PScurrentdevparams +PScurrentglobal +PScurrentoverprint +PScurrentpagedevice +PScurrentsystemparams +PScurrentuserparams +PSdefineresource +PSexecform +PSfilter +PSfindencoding +PSfindresource +PSgcheck +PSglobaldict +PSglyphshow +PSlanguagelevel +PSleftbracket +PSleftleft +PSmakepattern +PSproduct +PSresourceforall +PSresourcestatus +PSrevision +PSrightbracket +PSrightright +PSrootfont +PSserialnumber +PSsetcolor +PSsetcolorrendering +PSsetcolorspace +PSsetdevparams +PSsetglobal +PSsetoverprint +PSsetpagedevice +PSsetpattern +PSsetsystemparams +PSsetuserparams +PSstartjob +PSundefineresource + +/* $XFree86: xc/lib/dps/dps-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */ diff --git a/xc/lib/dpstk/dpstk-def.cpp b/xc/lib/dpstk/dpstk-def.cpp new file mode 100644 index 000000000..8304cfdf4 --- /dev/null +++ b/xc/lib/dpstk/dpstk-def.cpp @@ -0,0 +1,65 @@ +LIBRARY DPSTK +VERSION LIBRARY_VERSION +EXPORTS +_DPSPCheckForError +_DPSPClearArea +_DPSPDefineExecFunction +_DPSPSaveBeforeExec +_DPSPSetMaskTransfer +_DPSPSetMatrix +_DPSSCaptureGState +_DPSSDefineUserObject +_DPSSInstallDPSlibDict +_DPSSRestoreGState +_DPSSSetContextDrawable +_DPSSSetContextParameters +_DPSSUndefineUserObject +_DPSSUpdateGState +DPSDefineAsUserObj +DPSRedefineUserObj +DPSReserveUserObjIndices +DPSReturnUserObjIndices +DPSUndefineUserObj +PSDefineAsUserObj +PSRedefineUserObj +PSReserveUserObjIndices +PSReturnUserObjIndices +PSUndefineUserObj +XDPSCaptureContextGState +XDPSChainTextContext +XDPSDestroySharedContext +XDPSExtensionPresent +XDPSFreeContextGState +XDPSFreeDisplayInfo +XDPSGetSharedContext +XDPSPopContextGState +XDPSPopContextParameters +XDPSPushContextGState +XDPSPushContextParameters +XDPSRegisterContext +XDPSSetContextDepth +XDPSSetContextDrawable +XDPSSetContextGState +XDPSSetContextGrayMap +XDPSSetContextParameters +XDPSSetContextRGBMap +XDPSUnregisterContext +XDPSUpdateContextGState +_XDPSSetComponentInitialized +_XDPSTestComponentInitialized +XDPSCheckImagingResults +XDPSCreatePixmapForEPSF +XDPSEmbeddedEPSFRewindFunc +XDPSEmbeddedGetsFunc +XDPSFileGetsFunc +XDPSFileRewindFunc +XDPSImageFileIntoDrawable +XDPSPixelsPerPoint +XDPSSetFileFunctions +XDPSSetImagingTimeout +DPSDoUserPath +DPSHitUserPath +PSDoUserPath +PSHitUserPath + +/* $XFree86: xc/lib/dpstk/dpstk-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */ diff --git a/xc/lib/font/FreeType/ftfuncs.c b/xc/lib/font/FreeType/ftfuncs.c index 9d8611f36..5bf19f22e 100644 --- a/xc/lib/font/FreeType/ftfuncs.c +++ b/xc/lib/font/FreeType/ftfuncs.c @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.14 2000/04/05 18:13:24 dawes Exp $ */ +/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.15 2000/08/11 21:12:42 dawes Exp $ */ #ifndef FONT_MODULE #include <string.h> @@ -143,6 +143,7 @@ FreeTypeOpenFace(TTFFace **facep, char *fileName) if(ttf_checkForTTCName(fileName, &realFileName, &faceNumber)) { ftrc=TT_Open_Collection(ftypeEngine, realFileName, faceNumber, &face->face); + xfree(realFileName); } else { ftrc=TT_Open_Face(ftypeEngine, fileName, &face->face); } diff --git a/xc/lib/font/FreeType/ftutil.c b/xc/lib/font/FreeType/ftutil.c index 8b04b9cee..da2fcd940 100644 --- a/xc/lib/font/FreeType/ftutil.c +++ b/xc/lib/font/FreeType/ftutil.c @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/lib/font/FreeType/ftutil.c,v 1.10 1999/10/13 04:20:50 dawes Exp $ */ +/* $XFree86: xc/lib/font/FreeType/ftutil.c,v 1.11 2000/08/11 21:12:42 dawes Exp $ */ #ifndef FONTMODULE #include <ctype.h> @@ -210,30 +210,42 @@ ttf_checkForTTCName(char *fileName, char **realFileName, int *faceNumber) { int length; int fn; - int i; + int i, j; + char *start, *realName; length=strlen(fileName); - if(length<3) + if(length<4) + return 0; + + if(strcasecmp(fileName+(length-4), ".ttc")) return 0; - if(strcasecmp(fileName+(length-3), ".ttc")) + if (!(realName = xalloc(length + 1))) return 0; - if(fileName[0]==':') { + strcpy(realName, fileName); + *realFileName=realName; + start = strchr(realName, ':'); + if (start) { fn=0; i=1; - while(isdigit(fileName[i])) { + while(isdigit(start[i])) { fn*=10; - fn+=fileName[i]-'0'; + fn+=start[i]-'0'; + i++; } - if(fileName[i]==':') { + if(start[i]==':') { *faceNumber=fn; - *realFileName=&(fileName[i+1]); + i++; + j = 0; + while (start[i]) { + start[j++] = start[i++]; + } + start[j] = '\0'; return 1; } } *faceNumber=0; - *realFileName=fileName; return 1; } diff --git a/xc/lib/font/Type1/regions.h b/xc/lib/font/Type1/regions.h index 10c83780a..1aece83d3 100644 --- a/xc/lib/font/Type1/regions.h +++ b/xc/lib/font/Type1/regions.h @@ -26,7 +26,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/lib/font/Type1/regions.h,v 1.5 2000/04/28 18:19:20 eich Exp $ */ +/* $XFree86: xc/lib/font/Type1/regions.h,v 1.6 2000/08/09 23:40:15 dawes Exp $ */ /*SHARED*/ #define Interior(p,rule) t1_Interior(p,rule) @@ -45,6 +45,10 @@ struct region *t1_Complement(); /* complement of a region */ int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ #endif +#ifdef __CYGWIN__ +#define __STRICT_ANSI__ +#endif + #define TT_INFINITY t1_Infinity /*END SHARED*/ diff --git a/xc/lib/font/fontfile/filewr.c b/xc/lib/font/fontfile/filewr.c index 0d91f3d83..72adbd10c 100644 --- a/xc/lib/font/fontfile/filewr.c +++ b/xc/lib/font/fontfile/filewr.c @@ -21,7 +21,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/filewr.c,v 3.3 1999/08/21 13:48:03 dawes Exp $ */ +/* $XFree86: xc/lib/font/fontfile/filewr.c,v 3.4 2000/08/09 23:40:15 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -35,7 +35,7 @@ FontFileOpenWrite (const char *name) { int fd; -#if defined(WIN32) || defined(__EMX__) +#if defined(WIN32) || defined(__EMX__) || defined(__CYGWIN__) fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY, 0666); #else fd = creat (name, 0666); diff --git a/xc/lib/psres/Imakefile b/xc/lib/psres/Imakefile index d387e336d..7af8837be 100644 --- a/xc/lib/psres/Imakefile +++ b/xc/lib/psres/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/psres/Imakefile,v 1.3 2000/02/15 01:44:57 dawes Exp $ +XCOMM $XFree86: xc/lib/psres/Imakefile,v 1.4 2000/08/09 23:40:15 dawes Exp $ #define DoNormalLib NormalLibPSRes #define DoSharedLib SharedLibPSRes @@ -9,6 +9,10 @@ XCOMM $XFree86: xc/lib/psres/Imakefile,v 1.3 2000/02/15 01:44:57 dawes Exp $ #define SoRev SOPSRESREV #define LibHeaders NO +#ifdef SharedPSResReqs +REQUIREDLIBS = SharedPSResReqs +#endif + PSWRAP = $(TOP)/config/pswrap/pswrap diff --git a/xc/lib/psres/psres-def.cpp b/xc/lib/psres/psres-def.cpp new file mode 100644 index 000000000..e9f690f9d --- /dev/null +++ b/xc/lib/psres/psres-def.cpp @@ -0,0 +1,11 @@ +LIBRARY psres +VERSION LIBRARY_VERSION +EXPORTS +;TCheckPSResourceTime +EnumeratePSResourceFiles +InSavedList +ListPSResourceFiles +ListPSResourceTypes +SetPSResourcePolicy + +/* $XFree86: xc/lib/psres/psres-def.cpp,v 1.1 2000/08/09 23:40:15 dawes Exp $ */ diff --git a/xc/lib/xtrans/Xtransutil.c b/xc/lib/xtrans/Xtransutil.c index f69f91279..54746223b 100644 --- a/xc/lib/xtrans/Xtransutil.c +++ b/xc/lib/xtrans/Xtransutil.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/xtrans/Xtransutil.c,v 3.15 2000/04/05 18:13:27 dawes Exp $ */ +/* $XFree86: xc/lib/xtrans/Xtransutil.c,v 3.16 2000/08/09 23:40:15 dawes Exp $ */ /* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * @@ -58,6 +58,12 @@ from The Open Group. #include <X11/Xthreads.h> #endif +#ifdef __CYGWIN__ +#include <sys/unistd.h> +#define fchown chown +#define fchmod chmod +#endif + #ifdef X11_t /* diff --git a/xc/lib/zlib/Imakefile b/xc/lib/zlib/Imakefile index 8846d459d..a710cbcbf 100644 --- a/xc/lib/zlib/Imakefile +++ b/xc/lib/zlib/Imakefile @@ -4,10 +4,15 @@ XCOMM $TOG: Imakefile /main/4 1998/02/04 14:32:56 kaleb $ -XCOMM $XFree86: xc/lib/zlib/Imakefile,v 1.6 1999/04/17 09:08:13 dawes Exp $ +XCOMM $XFree86: xc/lib/zlib/Imakefile,v 1.7 2000/08/09 23:40:16 dawes Exp $ +#ifndef cygwinArchitecture #define DoNormalLib YES #define DoSharedLib NO +#else +#define DoNormalLib NO +#define DoSharedLib YES +#endif #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO diff --git a/xc/lib/zlib/z-def.cpp b/xc/lib/zlib/z-def.cpp new file mode 100644 index 000000000..eeae2c8d2 --- /dev/null +++ b/xc/lib/zlib/z-def.cpp @@ -0,0 +1,47 @@ +#ifdef __CYGWIN__ +LIBRARY ZLIB +EXPORTS + adler32 @ 1 ; + compress @ 2 ; + compress2 @ 3 ; + crc32 @ 4 ; + deflate @ 5 ; + deflateCopy @ 6 ; + deflateEnd @ 7 ; + deflateInit2_ @ 8 ; + deflateInit_ @ 9 ; + deflateParams @ 10 ; + deflateReset @ 11 ; + deflateSetDictionary @ 12 ; + get_crc_table @ 13 ; + gzclose @ 14 ; + gzdopen @ 15 ; + gzeof @ 16 ; + gzerror @ 17 ; + gzflush @ 18 ; + gzgetc @ 19 ; +; gzgets @ 20 ; + gzopen @ 21 ; + gzprintf @ 22 ; + gzputc @ 23 ; +; gzputs @ 24 ; + gzread @ 25 ; + gzrewind @ 26 ; + gzseek @ 27 ; + gzsetparams @ 28 ; + gztell @ 29 ; + gzwrite @ 30 ; + inflate @ 31 ; + inflateEnd @ 32 ; + inflateInit2_ @ 33 ; + inflateInit_ @ 34 ; + inflateReset @ 35 ; + inflateSetDictionary @ 36 ; + inflateSync @ 37 ; + inflateSyncPoint @ 38 ; + uncompress @ 39 ; + zError @ 40 ; + zlibVersion @ 41 ; +#endif + +/* $XFree86: xc/lib/zlib/z-def.cpp,v 1.1 2000/08/09 23:40:16 dawes Exp $ */ diff --git a/xc/lib/zlib/zconf.h b/xc/lib/zlib/zconf.h index fd40cbb7b..1b2a54fc3 100644 --- a/xc/lib/zlib/zconf.h +++ b/xc/lib/zlib/zconf.h @@ -5,6 +5,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +/* $XFree86: xc/lib/zlib/zconf.h,v 1.6 2000/08/09 23:40:16 dawes Exp $ */ + #ifndef _ZCONF_H #define _ZCONF_H @@ -47,7 +49,7 @@ # define voidp z_voidp #endif -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__CYGWIN__) # define WIN32 #endif #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) || defined(__EMX__) diff --git a/xc/nls/locale.dir b/xc/nls/locale.dir index 4bd8e4021..aaec3bd17 100644 --- a/xc/nls/locale.dir +++ b/xc/nls/locale.dir @@ -4,7 +4,7 @@ XCOMM This file contains locale database file name XCOMM The first word is the locale database file name and XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/locale.dir,v 1.12 2000/02/12 02:54:28 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.dir,v 1.13 2000/08/09 20:19:32 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -48,6 +48,7 @@ iso8859-1/XLC_LOCALE en_AU.ISO8859-1 iso8859-1/XLC_LOCALE en_BZ.ISO8859-1 iso8859-1/XLC_LOCALE en_CA.ISO8859-1 iso8859-1/XLC_LOCALE en_GB.ISO8859-1 +iso8859-15/XLC_LOCALE en_GB.ISO8859-15 iso8859-1/XLC_LOCALE en_IE.ISO8859-1 iso8859-1/XLC_LOCALE en_JM.ISO8859-1 iso8859-1/XLC_LOCALE en_NZ.ISO8859-1 @@ -330,6 +331,7 @@ iso8859-1/XLC_LOCALE: en_AU.ISO8859-1 iso8859-1/XLC_LOCALE: en_BZ.ISO8859-1 iso8859-1/XLC_LOCALE: en_CA.ISO8859-1 iso8859-1/XLC_LOCALE: en_GB.ISO8859-1 +iso8859-15/XLC_LOCALE: en_GB.ISO8859-15 iso8859-1/XLC_LOCALE: en_IE.ISO8859-1 iso8859-1/XLC_LOCALE: en_JM.ISO8859-1 iso8859-1/XLC_LOCALE: en_NZ.ISO8859-1 diff --git a/xc/programs/Xserver/GL/dri/dri-def.cpp b/xc/programs/Xserver/GL/dri/dri-def.cpp new file mode 100644 index 000000000..3389a8aa4 --- /dev/null +++ b/xc/programs/Xserver/GL/dri/dri-def.cpp @@ -0,0 +1,50 @@ +LIBRARY DRI +VERSION LIBRARY_VERSION +EXPORTS + +XFree86DRIExtensionInit +DRIAuthConnection +DRIBlockHandler +DRIClipNotify +DRICloseConnection +DRICloseScreen +DRIContextPrivDelete +DRICopyWindow +DRICreateContext +DRICreateContextPriv +DRICreateContextPrivFromHandle +DRICreateDrawable +DRICreateInfoRec +DRIDestroyContext +DRIDestroyContextPriv +DRIDestroyDrawable +DRIDestroyInfoRec +DRIDoBlockHandler +DRIDoWakeupHandler +DRIDrawablePrivDelete +DRIExtensionInit +DRIFinishScreenInit +DRIGetClientDriverName +DRIGetContext +DRIGetContextStore +DRIGetDeviceInfo +DRIGetDrawableIndex +DRIGetDrawableInfo +DRIGetDrawableStamp +DRIGetSAREAPrivate +DRIGetWrappedFuncs +DRILock +DRIOpenConnection +DRIPaintWindow +DRIPostValidateTree +DRIPrintDrawableLock +DRIQueryDirectRenderingCapable +DRIQueryVersion +DRIReset +DRIScreenInit +DRISwapContext +DRIUnlock +DRIValidateTree +DRIWakeupHandler + +/* $XFree86: xc/programs/Xserver/GL/dri/dri-def.cpp,v 1.1 2000/08/09 23:40:16 dawes Exp $ */ diff --git a/xc/programs/Xserver/GL/glx/glx-def.cpp b/xc/programs/Xserver/GL/glx/glx-def.cpp new file mode 100644 index 000000000..9f31ecd04 --- /dev/null +++ b/xc/programs/Xserver/GL/glx/glx-def.cpp @@ -0,0 +1,663 @@ +LIBRARY GLX +VERSION LIBRARY_VERSION +EXPORTS +__glXFBInitDrawable +__glXFreeBuffers +__glXPixInitDrawable +__glXResizeBuffers +__glXClientInfo +__glXCopyContext +__glXCreateContext +__glXCreateGLXPixmap +__glXDestroyContext +__glXDestroyGLXPixmap +__glXGetVisualConfigs +__glXIsDirect +__glXLookupContextByTag +__glXMakeCurrent +__glXQueryContextInfoEXT +__glXQueryExtensionsString +__glXQueryServerString +__glXQueryVersion +__glXRender +__glXRenderLarge +__glXSwapBuffers +__glXVendorPrivate +__glXVendorPrivateWithReply +__glXWaitGL +__glXWaitX +__glXSwapClientInfo +__glXSwapCopyContext +__glXSwapCreateContext +__glXSwapCreateGLXPixmap +__glXSwapDestroyContext +__glXSwapDestroyGLXPixmap +__glXSwapGetVisualConfigs +__glXSwapIsDirect +__glXSwapIsDirectReply +__glXSwapMakeCurrent +__glXSwapMakeCurrentReply +__glXSwapQueryContextInfoEXT +__glXSwapQueryContextInfoEXTReply +__glXSwapQueryExtensionsString +__glXSwapQueryServerString +__glXSwapQueryVersion +__glXSwapQueryVersionReply +__glXSwapRender +__glXSwapRenderLarge +__glXSwapSwapBuffers +__glXSwapUseXFont +__glXSwapVendorPrivate +__glXSwapVendorPrivateWithReply +__glXSwapWaitGL +__glXSwapWaitX +glxSwapQueryExtensionsStringReply +glxSwapQueryServerStringReply +GlxExtensionInit +GlxInitVisuals +GlxSetVisualConfigs +GlxWrapInitVisuals +__glXClearErrorOccured +__glXCoreType +__glXErrorCallBack +__glXErrorOccured +__glXFlushContextCache +__glXForceCurrent +__glXFreeContext +__glXNoSuchRenderOpcode +__glXNoSuchSingleOpcode +__glXResetLargeCommandStatus +__glXFBGetGC +__glXFBMemSwapBuffers +__glXInitFB +__glXImpCalloc +__glXImpFatal +__glXImpFclose +__glXImpFopen +__glXImpFprintf +__glXImpFree +__glXImpGetDrawablePrivate +__glXImpGetenv +__glXImpMalloc +__glXImpRealloc +__glXImpSprintf +__glXImpWarning +__glXInitMem +__glXInitPix +__glXScreenInit +__glXAssociateContext +__glXCacheDrawableSize +__glXCalloc +__glXCreateDrawablePrivate +__glXDeassociateContext +__glXDestroyDrawablePrivate +__glXFindDrawablePrivate +__glXFormatGLModes +__glXFree +__glXGetDrawablePrivate +__glXGetDrawableSize +__glXMalloc +__glXNop +__glXRealloc +__glXRefDrawablePrivate +__glXResizeDrawable +__glXResizeDrawableBuffers +__glXUnrefDrawablePrivate +__glXDisp_CallLists +__glXDisp_DrawArrays +__glXDisp_Map1d +__glXDisp_Map1f +__glXDisp_Map2d +__glXDisp_Map2f +__glXDispSwap_CallLists +__glXDispSwap_DrawArrays +__glXDispSwap_Map1d +__glXDispSwap_Map1f +__glXDispSwap_Map2d +__glXDispSwap_Map2f +__glXDisp_Bitmap +__glXDisp_DrawPixels +__glXDisp_PolygonStipple +__glXDisp_TexImage1D +__glXDisp_TexImage2D +__glXDisp_TexSubImage1D +__glXDisp_TexSubImage2D +__glXDispSwap_Bitmap +__glXDispSwap_DrawPixels +__glXDispSwap_PolygonStipple +__glXDispSwap_TexImage1D +__glXDispSwap_TexImage2D +__glXDispSwap_TexSubImage1D +__glXDispSwap_TexSubImage2D +__glXBitmapReqSize +__glXCallListsReqSize +__glXDrawArraysSize +__glXDrawPixelsReqSize +__glXFogfvReqSize +__glXFogivReqSize +__glXLightModelfvReqSize +__glXLightModelivReqSize +__glXLightfvReqSize +__glXLightivReqSize +__glXMap1dReqSize +__glXMap1fReqSize +__glXMap2dReqSize +__glXMap2fReqSize +__glXMaterialfvReqSize +__glXMaterialivReqSize +__glXPixelMapfvReqSize +__glXPixelMapuivReqSize +__glXPixelMapusvReqSize +__glXPrioritizeTexturesReqSize +__glXTexEnvfvReqSize +__glXTexEnvivReqSize +__glXTexGendvReqSize +__glXTexGenfvReqSize +__glXTexGenivReqSize +__glXTexImage1DReqSize +__glXTexImage2DReqSize +__glXTexParameterfvReqSize +__glXTexParameterivReqSize +__glXTexSubImage1DReqSize +__glXTexSubImage2DReqSize +__glXTypeSize +__glXDisp_FeedbackBuffer +__glXDisp_Finish +__glXDisp_Flush +__glXDisp_GetClipPlane +__glXDisp_GetString +__glXDisp_RenderMode +__glXDisp_SelectBuffer +__glXcombine_strings +__glXDispSwap_FeedbackBuffer +__glXDispSwap_Finish +__glXDispSwap_Flush +__glXDispSwap_GetClipPlane +__glXDispSwap_GetString +__glXDispSwap_RenderMode +__glXDispSwap_SelectBuffer +__glXDisp_GetPolygonStipple +__glXDisp_GetTexImage +__glXDisp_ReadPixels +__glXDispSwap_GetPolygonStipple +__glXDispSwap_GetTexImage +__glXDispSwap_ReadPixels +__glGetBooleanv_size +__glGetDoublev_size +__glGetFloatv_size +__glGetIntegerv_size +__glGetLightfv_size +__glGetLightiv_size +__glGetMap_size +__glGetMapdv_size +__glGetMapfv_size +__glGetMapiv_size +__glGetMaterialfv_size +__glGetMaterialiv_size +__glGetPixelMap_size +__glGetPixelMapfv_size +__glGetPixelMapuiv_size +__glGetPixelMapusv_size +__glGetTexEnvfv_size +__glGetTexEnviv_size +__glGetTexGendv_size +__glGetTexGenfv_size +__glGetTexGeniv_size +__glGetTexImage_size +__glGetTexLevelParameterfv_size +__glGetTexLevelParameteriv_size +__glGetTexParameterfv_size +__glGetTexParameteriv_size +__glGet_size +__glReadPixels_size +__glXUseXFont +__glXDisp_Accum +__glXDisp_AlphaFunc +__glXDisp_Begin +__glXDisp_BindTexture +__glXDisp_BlendFunc +__glXDisp_CallList +__glXDisp_Clear +__glXDisp_ClearAccum +__glXDisp_ClearColor +__glXDisp_ClearDepth +__glXDisp_ClearIndex +__glXDisp_ClearStencil +__glXDisp_ClipPlane +__glXDisp_Color3bv +__glXDisp_Color3dv +__glXDisp_Color3fv +__glXDisp_Color3iv +__glXDisp_Color3sv +__glXDisp_Color3ubv +__glXDisp_Color3uiv +__glXDisp_Color3usv +__glXDisp_Color4bv +__glXDisp_Color4dv +__glXDisp_Color4fv +__glXDisp_Color4iv +__glXDisp_Color4sv +__glXDisp_Color4ubv +__glXDisp_Color4uiv +__glXDisp_Color4usv +__glXDisp_ColorMask +__glXDisp_ColorMaterial +__glXDisp_CopyPixels +__glXDisp_CopyTexImage1D +__glXDisp_CopyTexImage2D +__glXDisp_CopyTexSubImage1D +__glXDisp_CopyTexSubImage2D +__glXDisp_CullFace +__glXDisp_DepthFunc +__glXDisp_DepthMask +__glXDisp_DepthRange +__glXDisp_Disable +__glXDisp_DrawBuffer +__glXDisp_EdgeFlagv +__glXDisp_Enable +__glXDisp_End +__glXDisp_EvalCoord1dv +__glXDisp_EvalCoord1fv +__glXDisp_EvalCoord2dv +__glXDisp_EvalCoord2fv +__glXDisp_EvalMesh1 +__glXDisp_EvalMesh2 +__glXDisp_EvalPoint1 +__glXDisp_EvalPoint2 +__glXDisp_Fogf +__glXDisp_Fogfv +__glXDisp_Fogi +__glXDisp_Fogiv +__glXDisp_FrontFace +__glXDisp_Frustum +__glXDisp_Hint +__glXDisp_IndexMask +__glXDisp_Indexdv +__glXDisp_Indexfv +__glXDisp_Indexiv +__glXDisp_Indexsv +__glXDisp_Indexubv +__glXDisp_InitNames +__glXDisp_LightModelf +__glXDisp_LightModelfv +__glXDisp_LightModeli +__glXDisp_LightModeliv +__glXDisp_Lightf +__glXDisp_Lightfv +__glXDisp_Lighti +__glXDisp_Lightiv +__glXDisp_LineStipple +__glXDisp_LineWidth +__glXDisp_ListBase +__glXDisp_LoadIdentity +__glXDisp_LoadMatrixd +__glXDisp_LoadMatrixf +__glXDisp_LoadName +__glXDisp_LogicOp +__glXDisp_MapGrid1d +__glXDisp_MapGrid1f +__glXDisp_MapGrid2d +__glXDisp_MapGrid2f +__glXDisp_Materialf +__glXDisp_Materialfv +__glXDisp_Materiali +__glXDisp_Materialiv +__glXDisp_MatrixMode +__glXDisp_MultMatrixd +__glXDisp_MultMatrixf +__glXDisp_Normal3bv +__glXDisp_Normal3dv +__glXDisp_Normal3fv +__glXDisp_Normal3iv +__glXDisp_Normal3sv +__glXDisp_Ortho +__glXDisp_PassThrough +__glXDisp_PixelMapfv +__glXDisp_PixelMapuiv +__glXDisp_PixelMapusv +__glXDisp_PixelTransferf +__glXDisp_PixelTransferi +__glXDisp_PixelZoom +__glXDisp_PointSize +__glXDisp_PolygonMode +__glXDisp_PolygonOffset +__glXDisp_PopAttrib +__glXDisp_PopMatrix +__glXDisp_PopName +__glXDisp_PrioritizeTextures +__glXDisp_PushAttrib +__glXDisp_PushMatrix +__glXDisp_PushName +__glXDisp_RasterPos2dv +__glXDisp_RasterPos2fv +__glXDisp_RasterPos2iv +__glXDisp_RasterPos2sv +__glXDisp_RasterPos3dv +__glXDisp_RasterPos3fv +__glXDisp_RasterPos3iv +__glXDisp_RasterPos3sv +__glXDisp_RasterPos4dv +__glXDisp_RasterPos4fv +__glXDisp_RasterPos4iv +__glXDisp_RasterPos4sv +__glXDisp_ReadBuffer +__glXDisp_Rectdv +__glXDisp_Rectfv +__glXDisp_Rectiv +__glXDisp_Rectsv +__glXDisp_Rotated +__glXDisp_Rotatef +__glXDisp_Scaled +__glXDisp_Scalef +__glXDisp_Scissor +__glXDisp_ShadeModel +__glXDisp_StencilFunc +__glXDisp_StencilMask +__glXDisp_StencilOp +__glXDisp_TexCoord1dv +__glXDisp_TexCoord1fv +__glXDisp_TexCoord1iv +__glXDisp_TexCoord1sv +__glXDisp_TexCoord2dv +__glXDisp_TexCoord2fv +__glXDisp_TexCoord2iv +__glXDisp_TexCoord2sv +__glXDisp_TexCoord3dv +__glXDisp_TexCoord3fv +__glXDisp_TexCoord3iv +__glXDisp_TexCoord3sv +__glXDisp_TexCoord4dv +__glXDisp_TexCoord4fv +__glXDisp_TexCoord4iv +__glXDisp_TexCoord4sv +__glXDisp_TexEnvf +__glXDisp_TexEnvfv +__glXDisp_TexEnvi +__glXDisp_TexEnviv +__glXDisp_TexGend +__glXDisp_TexGendv +__glXDisp_TexGenf +__glXDisp_TexGenfv +__glXDisp_TexGeni +__glXDisp_TexGeniv +__glXDisp_TexParameterf +__glXDisp_TexParameterfv +__glXDisp_TexParameteri +__glXDisp_TexParameteriv +__glXDisp_Translated +__glXDisp_Translatef +__glXDisp_Vertex2dv +__glXDisp_Vertex2fv +__glXDisp_Vertex2iv +__glXDisp_Vertex2sv +__glXDisp_Vertex3dv +__glXDisp_Vertex3fv +__glXDisp_Vertex3iv +__glXDisp_Vertex3sv +__glXDisp_Vertex4dv +__glXDisp_Vertex4fv +__glXDisp_Vertex4iv +__glXDisp_Vertex4sv +__glXDisp_Viewport +__glXDispSwap_Accum +__glXDispSwap_AlphaFunc +__glXDispSwap_Begin +__glXDispSwap_BindTexture +__glXDispSwap_BlendFunc +__glXDispSwap_CallList +__glXDispSwap_Clear +__glXDispSwap_ClearAccum +__glXDispSwap_ClearColor +__glXDispSwap_ClearDepth +__glXDispSwap_ClearIndex +__glXDispSwap_ClearStencil +__glXDispSwap_ClipPlane +__glXDispSwap_Color3bv +__glXDispSwap_Color3dv +__glXDispSwap_Color3fv +__glXDispSwap_Color3iv +__glXDispSwap_Color3sv +__glXDispSwap_Color3ubv +__glXDispSwap_Color3uiv +__glXDispSwap_Color3usv +__glXDispSwap_Color4bv +__glXDispSwap_Color4dv +__glXDispSwap_Color4fv +__glXDispSwap_Color4iv +__glXDispSwap_Color4sv +__glXDispSwap_Color4ubv +__glXDispSwap_Color4uiv +__glXDispSwap_Color4usv +__glXDispSwap_ColorMask +__glXDispSwap_ColorMaterial +__glXDispSwap_CopyPixels +__glXDispSwap_CopyTexImage1D +__glXDispSwap_CopyTexImage2D +__glXDispSwap_CopyTexSubImage1D +__glXDispSwap_CopyTexSubImage2D +__glXDispSwap_CullFace +__glXDispSwap_DepthFunc +__glXDispSwap_DepthMask +__glXDispSwap_DepthRange +__glXDispSwap_Disable +__glXDispSwap_DrawBuffer +__glXDispSwap_EdgeFlagv +__glXDispSwap_Enable +__glXDispSwap_End +__glXDispSwap_EvalCoord1dv +__glXDispSwap_EvalCoord1fv +__glXDispSwap_EvalCoord2dv +__glXDispSwap_EvalCoord2fv +__glXDispSwap_EvalMesh1 +__glXDispSwap_EvalMesh2 +__glXDispSwap_EvalPoint1 +__glXDispSwap_EvalPoint2 +__glXDispSwap_Fogf +__glXDispSwap_Fogfv +__glXDispSwap_Fogi +__glXDispSwap_Fogiv +__glXDispSwap_FrontFace +__glXDispSwap_Frustum +__glXDispSwap_Hint +__glXDispSwap_IndexMask +__glXDispSwap_Indexdv +__glXDispSwap_Indexfv +__glXDispSwap_Indexiv +__glXDispSwap_Indexsv +__glXDispSwap_Indexubv +__glXDispSwap_InitNames +__glXDispSwap_LightModelf +__glXDispSwap_LightModelfv +__glXDispSwap_LightModeli +__glXDispSwap_LightModeliv +__glXDispSwap_Lightf +__glXDispSwap_Lightfv +__glXDispSwap_Lighti +__glXDispSwap_Lightiv +__glXDispSwap_LineStipple +__glXDispSwap_LineWidth +__glXDispSwap_ListBase +__glXDispSwap_LoadIdentity +__glXDispSwap_LoadMatrixd +__glXDispSwap_LoadMatrixf +__glXDispSwap_LoadName +__glXDispSwap_LogicOp +__glXDispSwap_MapGrid1d +__glXDispSwap_MapGrid1f +__glXDispSwap_MapGrid2d +__glXDispSwap_MapGrid2f +__glXDispSwap_Materialf +__glXDispSwap_Materialfv +__glXDispSwap_Materiali +__glXDispSwap_Materialiv +__glXDispSwap_MatrixMode +__glXDispSwap_MultMatrixd +__glXDispSwap_MultMatrixf +__glXDispSwap_Normal3bv +__glXDispSwap_Normal3dv +__glXDispSwap_Normal3fv +__glXDispSwap_Normal3iv +__glXDispSwap_Normal3sv +__glXDispSwap_Ortho +__glXDispSwap_PassThrough +__glXDispSwap_PixelMapfv +__glXDispSwap_PixelMapuiv +__glXDispSwap_PixelMapusv +__glXDispSwap_PixelTransferf +__glXDispSwap_PixelTransferi +__glXDispSwap_PixelZoom +__glXDispSwap_PointSize +__glXDispSwap_PolygonMode +__glXDispSwap_PolygonOffset +__glXDispSwap_PopAttrib +__glXDispSwap_PopMatrix +__glXDispSwap_PopName +__glXDispSwap_PrioritizeTextures +__glXDispSwap_PushAttrib +__glXDispSwap_PushMatrix +__glXDispSwap_PushName +__glXDispSwap_RasterPos2dv +__glXDispSwap_RasterPos2fv +__glXDispSwap_RasterPos2iv +__glXDispSwap_RasterPos2sv +__glXDispSwap_RasterPos3dv +__glXDispSwap_RasterPos3fv +__glXDispSwap_RasterPos3iv +__glXDispSwap_RasterPos3sv +__glXDispSwap_RasterPos4dv +__glXDispSwap_RasterPos4fv +__glXDispSwap_RasterPos4iv +__glXDispSwap_RasterPos4sv +__glXDispSwap_ReadBuffer +__glXDispSwap_Rectdv +__glXDispSwap_Rectfv +__glXDispSwap_Rectiv +__glXDispSwap_Rectsv +__glXDispSwap_Rotated +__glXDispSwap_Rotatef +__glXDispSwap_Scaled +__glXDispSwap_Scalef +__glXDispSwap_Scissor +__glXDispSwap_ShadeModel +__glXDispSwap_StencilFunc +__glXDispSwap_StencilMask +__glXDispSwap_StencilOp +__glXDispSwap_TexCoord1dv +__glXDispSwap_TexCoord1fv +__glXDispSwap_TexCoord1iv +__glXDispSwap_TexCoord1sv +__glXDispSwap_TexCoord2dv +__glXDispSwap_TexCoord2fv +__glXDispSwap_TexCoord2iv +__glXDispSwap_TexCoord2sv +__glXDispSwap_TexCoord3dv +__glXDispSwap_TexCoord3fv +__glXDispSwap_TexCoord3iv +__glXDispSwap_TexCoord3sv +__glXDispSwap_TexCoord4dv +__glXDispSwap_TexCoord4fv +__glXDispSwap_TexCoord4iv +__glXDispSwap_TexCoord4sv +__glXDispSwap_TexEnvf +__glXDispSwap_TexEnvfv +__glXDispSwap_TexEnvi +__glXDispSwap_TexEnviv +__glXDispSwap_TexGend +__glXDispSwap_TexGendv +__glXDispSwap_TexGenf +__glXDispSwap_TexGenfv +__glXDispSwap_TexGeni +__glXDispSwap_TexGeniv +__glXDispSwap_TexParameterf +__glXDispSwap_TexParameterfv +__glXDispSwap_TexParameteri +__glXDispSwap_TexParameteriv +__glXDispSwap_Translated +__glXDispSwap_Translatef +__glXDispSwap_Vertex2dv +__glXDispSwap_Vertex2fv +__glXDispSwap_Vertex2iv +__glXDispSwap_Vertex2sv +__glXDispSwap_Vertex3dv +__glXDispSwap_Vertex3fv +__glXDispSwap_Vertex3iv +__glXDispSwap_Vertex3sv +__glXDispSwap_Vertex4dv +__glXDispSwap_Vertex4fv +__glXDispSwap_Vertex4iv +__glXDispSwap_Vertex4sv +__glXDispSwap_Viewport +__glXDisp_AreTexturesResident +__glXDisp_DeleteLists +__glXDisp_DeleteTextures +__glXDisp_EndList +__glXDisp_GenLists +__glXDisp_GenTextures +__glXDisp_GetBooleanv +__glXDisp_GetDoublev +__glXDisp_GetError +__glXDisp_GetFloatv +__glXDisp_GetIntegerv +__glXDisp_GetLightfv +__glXDisp_GetLightiv +__glXDisp_GetMapdv +__glXDisp_GetMapfv +__glXDisp_GetMapiv +__glXDisp_GetMaterialfv +__glXDisp_GetMaterialiv +__glXDisp_GetPixelMapfv +__glXDisp_GetPixelMapuiv +__glXDisp_GetPixelMapusv +__glXDisp_GetTexEnvfv +__glXDisp_GetTexEnviv +__glXDisp_GetTexGendv +__glXDisp_GetTexGenfv +__glXDisp_GetTexGeniv +__glXDisp_GetTexLevelParameterfv +__glXDisp_GetTexLevelParameteriv +__glXDisp_GetTexParameterfv +__glXDisp_GetTexParameteriv +__glXDisp_IsEnabled +__glXDisp_IsList +__glXDisp_IsTexture +__glXDisp_NewList +__glXDisp_PixelStoref +__glXDisp_PixelStorei +__glXDispSwap_AreTexturesResident +__glXDispSwap_DeleteLists +__glXDispSwap_DeleteTextures +__glXDispSwap_EndList +__glXDispSwap_GenLists +__glXDispSwap_GenTextures +__glXDispSwap_GetBooleanv +__glXDispSwap_GetDoublev +__glXDispSwap_GetError +__glXDispSwap_GetFloatv +__glXDispSwap_GetIntegerv +__glXDispSwap_GetLightfv +__glXDispSwap_GetLightiv +__glXDispSwap_GetMapdv +__glXDispSwap_GetMapfv +__glXDispSwap_GetMapiv +__glXDispSwap_GetMaterialfv +__glXDispSwap_GetMaterialiv +__glXDispSwap_GetPixelMapfv +__glXDispSwap_GetPixelMapuiv +__glXDispSwap_GetPixelMapusv +__glXDispSwap_GetTexEnvfv +__glXDispSwap_GetTexEnviv +__glXDispSwap_GetTexGendv +__glXDispSwap_GetTexGenfv +__glXDispSwap_GetTexGeniv +__glXDispSwap_GetTexLevelParameterfv +__glXDispSwap_GetTexLevelParameteriv +__glXDispSwap_GetTexParameterfv +__glXDispSwap_GetTexParameteriv +__glXDispSwap_IsEnabled +__glXDispSwap_IsList +__glXDispSwap_IsTexture +__glXDispSwap_NewList +__glXDispSwap_PixelStoref +__glXDispSwap_PixelStorei + +/* $XFree86: xc/programs/Xserver/GL/glx/glx-def.cpp,v 1.1 2000/08/10 17:40:29 dawes Exp $ */ diff --git a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile index 69ea6c654..03c5ad314 100644 --- a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile +++ b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile @@ -1,13 +1,13 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.5 2000/06/30 18:27:01 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.6 2000/08/01 20:28:39 dawes Exp $ #define IHaveModules #include <Server.tmpl> DEFINES = $(GLX_DEFINES) -LinkSourceFile(gl.h, ../../../../../../extras/Mesa/include/GL) -LinkSourceFile(glx.h, ../../../../../../../xc/include/GL) -LinkSourceFile(glxtokens.h, ../../../../../../../xc/include/GL) -LinkSourceFile(xmesa.h, ../../../../../../extras/Mesa/include/GL) -LinkSourceFile(xmesa_x.h, ../../../../../../extras/Mesa/include/GL) -LinkSourceFile(xmesa_xf86.h, ../../../../../../extras/Mesa/include/GL) +LinkSourceFile(gl.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(glx.h, $(TOP)/include/GL) +LinkSourceFile(glxtokens.h, $(TOP)/include/GL) +LinkSourceFile(xmesa.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(xmesa_x.h, $(MESASRCDIR)/include/GL) +LinkSourceFile(xmesa_xf86.h, $(MESASRCDIR)/include/GL) diff --git a/xc/programs/Xserver/GL/mesa/src/GLcore-def.cpp b/xc/programs/Xserver/GL/mesa/src/GLcore-def.cpp new file mode 100644 index 000000000..67822f290 --- /dev/null +++ b/xc/programs/Xserver/GL/mesa/src/GLcore-def.cpp @@ -0,0 +1,1483 @@ +LIBRARY GLcore +VERSION LIBRARY_VERSION +EXPORTS + +_mesa_set_aa_triangle_function +_mesa_Accum +_mesa_ClearAccum +_mesa_alloc_accum_buffer +_mesa_clear_accum_buffer +_mesa_AlphaFunc +_mesa_alpha_test +_mesa_alloc_alpha_buffers +_mesa_clear_alpha_buffers +_mesa_read_alpha_pixels +_mesa_read_alpha_span +_mesa_write_alpha_pixels +_mesa_write_alpha_span +_mesa_write_mono_alpha_pixels +_mesa_write_mono_alpha_span +_mesa_PopAttrib +_mesa_PopClientAttrib +_mesa_PushAttrib +_mesa_PushClientAttrib +_mesa_Bitmap +_mesa_BlendColor +_mesa_BlendEquation +_mesa_BlendFunc +_mesa_BlendFuncSeparateEXT +_mesa_blend_pixels +_mesa_blend_span +_mesa_Clear +_mesa_ClearColor +_mesa_ClearIndex +_mesa_DrawBuffer +_mesa_ReadBuffer +_mesa_ResizeBuffersMESA +_mesa_ClipPlane +_mesa_GetClipPlane +gl_init_clip +gl_update_clipmask +gl_update_userclip +gl_user_cliptest +gl_userclip_point +gl_viewclip_point +_mesa_ColorSubTable +_mesa_ColorTable +_mesa_ColorTableParameterfv +_mesa_ColorTableParameteriv +_mesa_CopyColorSubTable +_mesa_CopyColorTable +_mesa_GetColorTable +_mesa_GetColorTableParameterfv +_mesa_GetColorTableParameteriv +_mesa_free_colortable_data +_mesa_init_colortable +gl_read_config_file +gl_register_config_var +_mesa_Finish +_mesa_Flush +_mesa_create_visual +_mesa_destroy_visual +_mesa_get_dispatch +_mesa_initialize_context +_mesa_initialize_framebuffer +_mesa_initialize_visual +_mesa_swapbuffers +gl_compile_error +gl_context_initialize +gl_copy_context +gl_create_context +gl_create_framebuffer +gl_create_visual +gl_destroy_context +gl_destroy_framebuffer +gl_destroy_visual +gl_error +gl_free_context_data +gl_get_current_context +gl_make_current +gl_make_current2 +gl_problem +gl_warning +_mesa_CopyPixels +_mesa_LockArraysEXT +_mesa_UnlockArraysEXT +gl_alloc_cva_store +gl_cva_compile_cassette +gl_cva_force_precalc +gl_cva_init +gl_free_cva_store +gl_merge_cva +gl_prepare_arrays_cva +gl_rescue_cva +_mesa_ClearDepth +_mesa_DepthFunc +_mesa_DepthMask +_mesa_alloc_depth_buffer +_mesa_clear_depth_buffer +_mesa_depth_test_pixels +_mesa_depth_test_span +_mesa_read_depth_span +_mesa_read_depth_span_float +_mesa_zbuffer_address +glAccum +glActiveTextureARB +glAlphaFunc +glAreTexturesResident +glAreTexturesResidentEXT +glArrayElement +glArrayElementEXT +glBegin +glBindTexture +glBindTextureEXT +glBitmap +glBlendColor +glBlendColorEXT +glBlendEquation +glBlendEquationEXT +glBlendFunc +glBlendFuncSeparateEXT +glBlendFuncSeparateINGR +glCallList +glCallLists +glClear +glClearAccum +glClearColor +glClearDepth +glClearIndex +glClearStencil +glClientActiveTextureARB +glClipPlane +glColor3b +glColor3bv +glColor3d +glColor3dv +glColor3f +glColor3fv +glColor3i +glColor3iv +glColor3s +glColor3sv +glColor3ub +glColor3ubv +glColor3ui +glColor3uiv +glColor3us +glColor3usv +glColor4b +glColor4bv +glColor4d +glColor4dv +glColor4f +glColor4fv +glColor4i +glColor4iv +glColor4s +glColor4sv +glColor4ub +glColor4ubv +glColor4ui +glColor4uiv +glColor4us +glColor4usv +glColorMask +glColorMaterial +glColorPointer +glColorPointerEXT +glColorSubTable +glColorSubTableEXT +glColorTable +glColorTableEXT +glColorTableParameterfv +glColorTableParameterfvSGI +glColorTableParameteriv +glColorTableParameterivSGI +glColorTableSGI +glCombinerInputNV +glCombinerOutputNV +glCombinerParameterfNV +glCombinerParameterfvNV +glCombinerParameteriNV +glCombinerParameterivNV +glCompressedTexImage1DARB +glCompressedTexImage2DARB +glCompressedTexImage3DARB +glCompressedTexSubImage1DARB +glCompressedTexSubImage2DARB +glCompressedTexSubImage3DARB +glConvolutionFilter1D +glConvolutionFilter1DEXT +glConvolutionFilter2D +glConvolutionFilter2DEXT +glConvolutionParameterf +glConvolutionParameterfEXT +glConvolutionParameterfv +glConvolutionParameterfvEXT +glConvolutionParameteri +glConvolutionParameteriEXT +glConvolutionParameteriv +glConvolutionParameterivEXT +glCopyColorSubTable +glCopyColorSubTableEXT +glCopyColorTable +glCopyColorTableSGI +glCopyConvolutionFilter1D +glCopyConvolutionFilter1DEXT +glCopyConvolutionFilter2D +glCopyConvolutionFilter2DEXT +glCopyPixels +glCopyTexImage1D +glCopyTexImage1DEXT +glCopyTexImage2D +glCopyTexImage2DEXT +glCopyTexSubImage1D +glCopyTexSubImage1DEXT +glCopyTexSubImage2D +glCopyTexSubImage2DEXT +glCopyTexSubImage3D +glCopyTexSubImage3DEXT +glCullFace +glCullParameterdvEXT +glCullParameterfvEXT +glDeleteLists +glDeleteTextures +glDeleteTexturesEXT +glDepthFunc +glDepthMask +glDepthRange +glDetailTexFuncSGIS +glDisable +glDisableClientState +glDrawArrays +glDrawArraysEXT +glDrawBuffer +glDrawElements +glDrawPixels +glDrawRangeElements +glDrawRangeElementsEXT +glEdgeFlag +glEdgeFlagPointer +glEdgeFlagPointerEXT +glEdgeFlagv +glEnable +glEnableClientState +glEnd +glEndList +glEvalCoord1d +glEvalCoord1dv +glEvalCoord1f +glEvalCoord1fv +glEvalCoord2d +glEvalCoord2dv +glEvalCoord2f +glEvalCoord2fv +glEvalMesh1 +glEvalMesh2 +glEvalPoint1 +glEvalPoint2 +glFeedbackBuffer +glFinalCombinerInputNV +glFinish +glFlush +glFlushRasterSGIX +glFlushVertexArrayRangeNV +glFogCoordPointerEXT +glFogCoorddEXT +glFogCoorddvEXT +glFogCoordfEXT +glFogCoordfvEXT +glFogf +glFogfv +glFogi +glFogiv +glFragmentColorMaterialSGIX +glFragmentLightModelfSGIX +glFragmentLightModelfvSGIX +glFragmentLightModeliSGIX +glFragmentLightModelivSGIX +glFragmentLightfSGIX +glFragmentLightfvSGIX +glFragmentLightiSGIX +glFragmentLightivSGIX +glFragmentMaterialfSGIX +glFragmentMaterialfvSGIX +glFragmentMaterialiSGIX +glFragmentMaterialivSGIX +glFrameZoomSGIX +glFrontFace +glFrustum +glGenLists +glGenTextures +glGenTexturesEXT +glGetBooleanv +glGetClipPlane +glGetColorTable +glGetColorTableEXT +glGetColorTableParameterfv +glGetColorTableParameterfvEXT +glGetColorTableParameterfvSGI +glGetColorTableParameteriv +glGetColorTableParameterivEXT +glGetColorTableParameterivSGI +glGetColorTableSGI +glGetCombinerInputParameterfvNV +glGetCombinerInputParameterivNV +glGetCombinerOutputParameterfvNV +glGetCombinerOutputParameterivNV +glGetCompressedTexImageARB +glGetConvolutionFilter +glGetConvolutionFilterEXT +glGetConvolutionParameterfv +glGetConvolutionParameterfvEXT +glGetConvolutionParameteriv +glGetConvolutionParameterivEXT +glGetDetailTexFuncSGIS +glGetDoublev +glGetError +glGetFinalCombinerInputParameterfvNV +glGetFinalCombinerInputParameterivNV +glGetFloatv +glGetFragmentLightfvSGIX +glGetFragmentLightivSGIX +glGetFragmentMaterialfvSGIX +glGetFragmentMaterialivSGIX +glGetHistogram +glGetHistogramEXT +glGetHistogramParameterfv +glGetHistogramParameterfvEXT +glGetHistogramParameteriv +glGetHistogramParameterivEXT +glGetInstrumentsSGIX +glGetIntegerv +glGetLightfv +glGetLightiv +glGetListParameterfvSGIX +glGetListParameterivSGIX +glGetMapdv +glGetMapfv +glGetMapiv +glGetMaterialfv +glGetMaterialiv +glGetMinmax +glGetMinmaxEXT +glGetMinmaxParameterfv +glGetMinmaxParameterfvEXT +glGetMinmaxParameteriv +glGetMinmaxParameterivEXT +glGetPixelMapfv +glGetPixelMapuiv +glGetPixelMapusv +glGetPixelTexGenParameterfvSGIS +glGetPixelTexGenParameterivSGIS +glGetPointerv +glGetPointervEXT +glGetPolygonStipple +glGetSeparableFilter +glGetSeparableFilterEXT +glGetSharpenTexFuncSGIS +glGetString +glGetTexEnvfv +glGetTexEnviv +glGetTexFilterFuncSGIS +glGetTexGendv +glGetTexGenfv +glGetTexGeniv +glGetTexImage +glGetTexLevelParameterfv +glGetTexLevelParameteriv +glGetTexParameterfv +glGetTexParameteriv +glHint +glHintPGI +glHistogram +glHistogramEXT +glIndexFuncEXT +glIndexMask +glIndexMaterialEXT +glIndexPointer +glIndexPointerEXT +glIndexd +glIndexdv +glIndexf +glIndexfv +glIndexi +glIndexiv +glIndexs +glIndexsv +glIndexub +glIndexubv +glInitNames +glInstrumentsBufferSGIX +glInterleavedArrays +glIsEnabled +glIsList +glIsTexture +glIsTextureEXT +glLightEnviSGIX +glLightModelf +glLightModelfv +glLightModeli +glLightModeliv +glLightf +glLightfv +glLighti +glLightiv +glLineStipple +glLineWidth +glListBase +glListParameterfSGIX +glListParameterfvSGIX +glListParameteriSGIX +glListParameterivSGIX +glLoadIdentity +glLoadMatrixd +glLoadMatrixf +glLoadName +glLoadTransposeMatrixdARB +glLoadTransposeMatrixfARB +glLockArraysEXT +glLogicOp +glMap1d +glMap1f +glMap2d +glMap2f +glMapGrid1d +glMapGrid1f +glMapGrid2d +glMapGrid2f +glMaterialf +glMaterialfv +glMateriali +glMaterialiv +glMatrixMode +glMinmax +glMinmaxEXT +glMultMatrixd +glMultMatrixf +glMultTransposeMatrixdARB +glMultTransposeMatrixfARB +glMultiTexCoord1dARB +glMultiTexCoord1dvARB +glMultiTexCoord1fARB +glMultiTexCoord1fvARB +glMultiTexCoord1iARB +glMultiTexCoord1ivARB +glMultiTexCoord1sARB +glMultiTexCoord1svARB +glMultiTexCoord2dARB +glMultiTexCoord2dvARB +glMultiTexCoord2fARB +glMultiTexCoord2fvARB +glMultiTexCoord2iARB +glMultiTexCoord2ivARB +glMultiTexCoord2sARB +glMultiTexCoord2svARB +glMultiTexCoord3dARB +glMultiTexCoord3dvARB +glMultiTexCoord3fARB +glMultiTexCoord3fvARB +glMultiTexCoord3iARB +glMultiTexCoord3ivARB +glMultiTexCoord3sARB +glMultiTexCoord3svARB +glMultiTexCoord4dARB +glMultiTexCoord4dvARB +glMultiTexCoord4fARB +glMultiTexCoord4fvARB +glMultiTexCoord4iARB +glMultiTexCoord4ivARB +glMultiTexCoord4sARB +glMultiTexCoord4svARB +glNewList +glNormal3b +glNormal3bv +glNormal3d +glNormal3dv +glNormal3f +glNormal3fv +glNormal3i +glNormal3iv +glNormal3s +glNormal3sv +glNormalPointer +glNormalPointerEXT +glOrtho +glPassThrough +glPixelMapfv +glPixelMapuiv +glPixelMapusv +glPixelStoref +glPixelStorei +glPixelTexGenParameterfSGIS +glPixelTexGenParameterfvSGIS +glPixelTexGenParameteriSGIS +glPixelTexGenParameterivSGIS +glPixelTexGenSGIX +glPixelTransferf +glPixelTransferi +glPixelZoom +glPointParameterfEXT +glPointParameterfSGIS +glPointParameterfvEXT +glPointParameterfvSGIS +glPointSize +glPollInstrumentsSGIX +glPolygonMode +glPolygonOffset +glPolygonOffsetEXT +glPolygonStipple +glPopAttrib +glPopClientAttrib +glPopMatrix +glPopName +glPrioritizeTextures +glPrioritizeTexturesEXT +glPushAttrib +glPushClientAttrib +glPushMatrix +glPushName +glRasterPos2d +glRasterPos2dv +glRasterPos2f +glRasterPos2fv +glRasterPos2i +glRasterPos2iv +glRasterPos2s +glRasterPos2sv +glRasterPos3d +glRasterPos3dv +glRasterPos3f +glRasterPos3fv +glRasterPos3i +glRasterPos3iv +glRasterPos3s +glRasterPos3sv +glRasterPos4d +glRasterPos4dv +glRasterPos4f +glRasterPos4fv +glRasterPos4i +glRasterPos4iv +glRasterPos4s +glRasterPos4sv +glReadBuffer +glReadInstrumentsSGIX +glReadPixels +glRectd +glRectdv +glRectf +glRectfv +glRecti +glRectiv +glRects +glRectsv +glReferencePlaneSGIX +glRenderMode +glResetHistogram +glResetHistogramEXT +glResetMinmax +glResetMinmaxEXT +glResizeBuffersMESA +glRotated +glRotatef +glSampleCoverageARB +glSampleMaskEXT +glSampleMaskSGIS +glSamplePassARB +glSamplePatternEXT +glSamplePatternSGIS +glScaled +glScalef +glScissor +glSelectBuffer +glSeparableFilter2D +glSeparableFilter2DEXT +glShadeModel +glSharpenTexFuncSGIS +glSpriteParameterfSGIX +glSpriteParameterfvSGIX +glSpriteParameteriSGIX +glSpriteParameterivSGIX +glStartInstrumentsSGIX +glStencilFunc +glStencilMask +glStencilOp +glStopInstrumentsSGIX +glTagSampleBufferSGIX +glTbufferMask3DFX +glTexCoord1d +glTexCoord1dv +glTexCoord1f +glTexCoord1fv +glTexCoord1i +glTexCoord1iv +glTexCoord1s +glTexCoord1sv +glTexCoord2d +glTexCoord2dv +glTexCoord2f +glTexCoord2fv +glTexCoord2i +glTexCoord2iv +glTexCoord2s +glTexCoord2sv +glTexCoord3d +glTexCoord3dv +glTexCoord3f +glTexCoord3fv +glTexCoord3i +glTexCoord3iv +glTexCoord3s +glTexCoord3sv +glTexCoord4d +glTexCoord4dv +glTexCoord4f +glTexCoord4fv +glTexCoord4i +glTexCoord4iv +glTexCoord4s +glTexCoord4sv +glTexCoordPointer +glTexCoordPointerEXT +glTexEnvf +glTexEnvfv +glTexEnvi +glTexEnviv +glTexFilterFuncSGIS +glTexGend +glTexGendv +glTexGenf +glTexGenfv +glTexGeni +glTexGeniv +glTexImage1D +glTexImage2D +glTexImage3D +glTexImage3DEXT +glTexImage4DSGIS +glTexParameterf +glTexParameterfv +glTexParameteri +glTexParameteriv +glTexSubImage1D +glTexSubImage1DEXT +glTexSubImage2D +glTexSubImage2DEXT +glTexSubImage3D +glTexSubImage3DEXT +glTexSubImage4DSGIS +glTranslated +glTranslatef +glUnlockArraysEXT +glVertex2d +glVertex2dv +glVertex2f +glVertex2fv +glVertex2i +glVertex2iv +glVertex2s +glVertex2sv +glVertex3d +glVertex3dv +glVertex3f +glVertex3fv +glVertex3i +glVertex3iv +glVertex3s +glVertex3sv +glVertex4d +glVertex4dv +glVertex4f +glVertex4fv +glVertex4i +glVertex4iv +glVertex4s +glVertex4sv +glVertexArrayRangeNV +glVertexPointer +glVertexPointerEXT +glVertexWeightPointerEXT +glVertexWeightfEXT +glVertexWeightfvEXT +glViewport +glWindowPos2dMESA +glWindowPos2dvMESA +glWindowPos2fMESA +glWindowPos2fvMESA +glWindowPos2iMESA +glWindowPos2ivMESA +glWindowPos2sMESA +glWindowPos2svMESA +glWindowPos3dMESA +glWindowPos3dvMESA +glWindowPos3fMESA +glWindowPos3fvMESA +glWindowPos3iMESA +glWindowPos3ivMESA +glWindowPos3sMESA +glWindowPos3svMESA +glWindowPos4dMESA +glWindowPos4dvMESA +glWindowPos4fMESA +glWindowPos4fvMESA +glWindowPos4iMESA +glWindowPos4ivMESA +glWindowPos4sMESA +glWindowPos4svMESA +_mesa_CallList +_mesa_CallLists +_mesa_DeleteLists +_mesa_EndList +_mesa_GenLists +_mesa_IsList +_mesa_ListBase +_mesa_NewList +_mesa_init_dlist_table +gl_compile_cassette +gl_destroy_list +gl_init_lists +gl_save_error +mesa_print_display_list +_mesa_DrawPixels +_mesa_clip_pixelrect +_mesa_Disable +_mesa_DisableClientState +_mesa_Enable +_mesa_EnableClientState +_mesa_IsEnabled +_mesa_set_enable +gl_lookup_enum_by_name +gl_lookup_enum_by_nr +_mesa_EvalCoord1d +_mesa_EvalCoord1dv +_mesa_EvalCoord1f +_mesa_EvalCoord1fv +_mesa_EvalCoord2d +_mesa_EvalCoord2dv +_mesa_EvalCoord2f +_mesa_EvalCoord2fv +_mesa_EvalMesh1 +_mesa_EvalMesh2 +_mesa_EvalPoint1 +_mesa_EvalPoint2 +_mesa_GetMapdv +_mesa_GetMapfv +_mesa_GetMapiv +_mesa_Map1d +_mesa_Map1f +_mesa_Map2d +_mesa_Map2f +_mesa_MapGrid1d +_mesa_MapGrid1f +_mesa_MapGrid2d +_mesa_MapGrid2f +_mesa_evaluator_components +gl_copy_map_points1d +gl_copy_map_points1f +gl_copy_map_points2d +gl_copy_map_points2f +gl_eval_vb +gl_init_eval +gl_extension_is_enabled +gl_extensions_add +gl_extensions_ctr +gl_extensions_disable +gl_extensions_dtr +gl_extensions_enable +gl_extensions_get_string +_mesa_FeedbackBuffer +_mesa_InitNames +_mesa_LoadName +_mesa_PassThrough +_mesa_PopName +_mesa_PushName +_mesa_RenderMode +_mesa_SelectBuffer +gl_feedback_line +gl_feedback_points +gl_feedback_triangle +gl_feedback_vertex +gl_select_line +gl_select_points +gl_select_triangle +gl_update_hitflag +_mesa_Fogf +_mesa_Fogfv +_mesa_Fogi +_mesa_Fogiv +_mesa_fog_ci_pixels +_mesa_fog_rgba_pixels +_mesa_fog_vertices +_mesa_init_fog +_mesa_GetBooleanv +_mesa_GetDoublev +_mesa_GetError +_mesa_GetFloatv +_mesa_GetIntegerv +_mesa_GetPointerv +_mesa_GetString +_glapi_add_entrypoint +_glapi_check_multithread +_glapi_check_table +_glapi_get_context +_glapi_get_dispatch +_glapi_get_dispatch_table_size +_glapi_get_proc_address +_glapi_get_proc_name +_glapi_get_proc_offset +_glapi_get_version +_glapi_set_context +_glapi_set_dispatch +_glapi_noop_enable_warnings +_glthread_GetID +_glthread_GetTSD +_glthread_InitTSD +_glthread_SetTSD +_mesa_DeleteHashTable +_mesa_HashFindFreeKeyBlock +_mesa_HashFirstEntry +_mesa_HashInsert +_mesa_HashLookup +_mesa_HashPrint +_mesa_HashRemove +_mesa_NewHashTable +_mesa_Hint +_mesa_HintPGI +_mesa_try_Hint +_mesa_bytes_per_pixel +_mesa_components_in_format +_mesa_image_address +_mesa_image_row_stride +_mesa_is_legal_format_and_type +_mesa_native_packing +_mesa_pack_bitmap +_mesa_pack_polygon_stipple +_mesa_pack_rgba_span +_mesa_sizeof_packed_type +_mesa_sizeof_type +_mesa_swap2 +_mesa_swap4 +_mesa_unpack_bitmap +_mesa_unpack_depth_span +_mesa_unpack_float_color_span +_mesa_unpack_image +_mesa_unpack_index_span +_mesa_unpack_polygon_stipple +_mesa_unpack_stencil_span +_mesa_unpack_ubyte_color_span +_mesa_ConvolutionFilter1D +_mesa_ConvolutionFilter2D +_mesa_ConvolutionParameterf +_mesa_ConvolutionParameterfv +_mesa_ConvolutionParameteri +_mesa_ConvolutionParameteriv +_mesa_CopyConvolutionFilter1D +_mesa_CopyConvolutionFilter2D +_mesa_GetConvolutionFilter +_mesa_GetConvolutionParameterfv +_mesa_GetConvolutionParameteriv +_mesa_GetHistogram +_mesa_GetHistogramParameterfv +_mesa_GetHistogramParameteriv +_mesa_GetMinmax +_mesa_GetMinmaxParameterfv +_mesa_GetMinmaxParameteriv +_mesa_GetSeparableFilter +_mesa_Histogram +_mesa_Minmax +_mesa_ResetHistogram +_mesa_ResetMinmax +_mesa_SeparableFilter2D +_mesa_update_histogram +_mesa_update_minmax +_mesa_ColorMaterial +_mesa_GetLightfv +_mesa_GetLightiv +_mesa_GetMaterialfv +_mesa_GetMaterialiv +_mesa_LightModelf +_mesa_LightModelfv +_mesa_LightModeli +_mesa_LightModeliv +_mesa_Lightf +_mesa_Lightfv +_mesa_Lighti +_mesa_Lightiv +_mesa_Materialf +_mesa_Materialfv +_mesa_Materiali +_mesa_Materialiv +_mesa_ShadeModel +gl_compute_light_positions +gl_compute_shine_table +gl_compute_spot_exp_table +gl_material_bitmask +gl_update_color_material +gl_update_lighting +gl_update_material +gl_update_normal_transform +_mesa_LineStipple +_mesa_LineWidth +gl_set_line_function +_mesa_LogicOp +_mesa_logicop_ci_pixels +_mesa_logicop_ci_span +_mesa_logicop_rgba_pixels +_mesa_logicop_rgba_span +_mesa_ColorMask +_mesa_IndexMask +_mesa_mask_index_pixels +_mesa_mask_index_span +_mesa_mask_rgba_pixels +_mesa_mask_rgba_span +_mesa_DepthRange +_mesa_Frustum +_mesa_LoadIdentity +_mesa_LoadMatrixd +_mesa_LoadMatrixf +_mesa_LoadTransposeMatrixdARB +_mesa_LoadTransposeMatrixfARB +_mesa_MatrixMode +_mesa_MultMatrixd +_mesa_MultMatrixf +_mesa_MultTransposeMatrixdARB +_mesa_MultTransposeMatrixfARB +_mesa_Ortho +_mesa_PopMatrix +_mesa_PushMatrix +_mesa_Rotated +_mesa_Rotatef +_mesa_Scaled +_mesa_Scalef +_mesa_Translated +_mesa_Translatef +_mesa_Viewport +gl_Viewport +gl_calculate_model_project_matrix +gl_mat_mul_floats +gl_mat_mul_mat +gl_matrix_alloc_inv +gl_matrix_analyze +gl_matrix_copy +gl_matrix_ctr +gl_matrix_dtr +gl_matrix_invert +gl_matrix_mul +gl_matrix_transposed +gl_matrix_transposef +gl_print_matrix +gl_rotation_matrix +_mesa_calloc +_mesa_free +_mesa_malloc +_mesa_bitcount +_mesa_init_math +gl_sqrt +gl_alloc_pb +gl_flush_pb +gl_build_immediate_pipeline +gl_build_precalc_pipeline +gl_pipeline_init +gl_print_active_pipeline +gl_print_pipe_ops +gl_print_pipeline +gl_print_tri_caps +gl_print_vert_flags +gl_reset_cva_vb +gl_run_pipeline +gl_update_pipelines +_mesa_GetPixelMapfv +_mesa_GetPixelMapuiv +_mesa_GetPixelMapusv +_mesa_PixelMapfv +_mesa_PixelMapuiv +_mesa_PixelMapusv +_mesa_PixelStoref +_mesa_PixelStorei +_mesa_PixelTransferf +_mesa_PixelTransferi +_mesa_PixelZoom +_mesa_lookup_rgba +_mesa_map_ci +_mesa_map_ci8_to_rgba +_mesa_map_ci_to_rgba +_mesa_map_ci_to_rgba_ubyte +_mesa_map_rgba +_mesa_map_stencil +_mesa_scale_and_bias_rgba +_mesa_shift_and_offset_ci +_mesa_shift_and_offset_stencil +_mesa_transform_rgba +_mesa_GetPixelTexGenParameterfvSGIS +_mesa_GetPixelTexGenParameterivSGIS +_mesa_PixelTexGenParameterfSGIS +_mesa_PixelTexGenParameterfvSGIS +_mesa_PixelTexGenParameteriSGIS +_mesa_PixelTexGenParameterivSGIS +_mesa_PixelTexGenSGIX +_mesa_pixeltexgen +_mesa_PointParameterfEXT +_mesa_PointParameterfvEXT +_mesa_PointSize +gl_set_point_function +_mesa_CullFace +_mesa_FrontFace +_mesa_GetPolygonStipple +_mesa_PolygonMode +_mesa_PolygonOffset +_mesa_PolygonOffsetEXT +_mesa_PolygonStipple +gl_set_quad_function +_mesa_RasterPos2d +_mesa_RasterPos2dv +_mesa_RasterPos2f +_mesa_RasterPos2fv +_mesa_RasterPos2i +_mesa_RasterPos2iv +_mesa_RasterPos2s +_mesa_RasterPos2sv +_mesa_RasterPos3d +_mesa_RasterPos3dv +_mesa_RasterPos3f +_mesa_RasterPos3fv +_mesa_RasterPos3i +_mesa_RasterPos3iv +_mesa_RasterPos3s +_mesa_RasterPos3sv +_mesa_RasterPos4d +_mesa_RasterPos4dv +_mesa_RasterPos4f +_mesa_RasterPos4fv +_mesa_RasterPos4i +_mesa_RasterPos4iv +_mesa_RasterPos4s +_mesa_RasterPos4sv +_mesa_ReadPixels +_mesa_Rectd +_mesa_Rectdv +_mesa_Rectf +_mesa_Rectfv +_mesa_Recti +_mesa_Rectiv +_mesa_Rects +_mesa_Rectsv +_mesa_Scissor +gl_scissor_pixels +gl_scissor_span +gl_init_shade +gl_shade_rastpos +gl_update_lighting_function +gl_read_index_span +gl_read_rgba_span +gl_write_index_span +gl_write_monocolor_span +gl_write_monoindex_span +gl_write_multitexture_span +gl_write_rgba_span +gl_write_texture_span +gl_clean_color +gl_default_nr_stages +gl_default_pipeline +gl_import_client_data +gl_init_vbxform +gl_update_materials +_mesa_init_exec_table +_mesa_init_no_op_table +gl_print_enable_flags +gl_print_state +gl_update_state +_mesa_ClearStencil +_mesa_StencilFunc +_mesa_StencilMask +_mesa_StencilOp +_mesa_alloc_stencil_buffer +_mesa_clear_stencil_buffer +_mesa_read_stencil_span +_mesa_stencil_and_ztest_pixels +_mesa_stencil_and_ztest_span +_mesa_write_stencil_span +_mesa_CompressedTexImage1DARB +_mesa_CompressedTexImage2DARB +_mesa_CompressedTexImage3DARB +_mesa_CompressedTexSubImage1DARB +_mesa_CompressedTexSubImage2DARB +_mesa_CompressedTexSubImage3DARB +_mesa_CopyTexImage1D +_mesa_CopyTexImage2D +_mesa_CopyTexSubImage1D +_mesa_CopyTexSubImage2D +_mesa_CopyTexSubImage3D +_mesa_GetCompressedTexImageARB +_mesa_GetTexImage +_mesa_TexImage1D +_mesa_TexImage2D +_mesa_TexImage3D +_mesa_TexImage3DEXT +_mesa_TexSubImage1D +_mesa_TexSubImage2D +_mesa_TexSubImage3D +_mesa_alloc_texture_image +_mesa_base_tex_format +_mesa_compressed_image_size +_mesa_free_texture_image +_mesa_get_teximage_from_driver +_mesa_select_tex_image +_mesa_select_tex_object +_mesa_AreTexturesResident +_mesa_BindTexture +_mesa_DeleteTextures +_mesa_GenTextures +_mesa_IsTexture +_mesa_PrioritizeTextures +_mesa_test_texobj_completeness +gl_alloc_texture_object +gl_free_texture_object +_mesa_ActiveTextureARB +_mesa_ClientActiveTextureARB +_mesa_GetTexEnvfv +_mesa_GetTexEnviv +_mesa_GetTexGendv +_mesa_GetTexGenfv +_mesa_GetTexGeniv +_mesa_GetTexLevelParameterfv +_mesa_GetTexLevelParameteriv +_mesa_GetTexParameterfv +_mesa_GetTexParameteriv +_mesa_TexEnvf +_mesa_TexEnvfv +_mesa_TexEnvi +_mesa_TexEnviv +_mesa_TexGend +_mesa_TexGendv +_mesa_TexGenf +_mesa_TexGenfv +_mesa_TexGeni +_mesa_TexGeniv +_mesa_TexParameterf +_mesa_TexParameterfv +_mesa_TexParameteri +_mesa_TexParameteriv +gl_put_texobj_on_dirty_list +gl_remove_texobj_from_dirty_list +gl_update_dirty_texobjs +_mesa_set_texture_sampler +gl_init_texture +gl_texture_pixels +gl_update_texture_unit +gl_init_translate +gl_cull_triangle +gl_set_triangle_function +_mesa_ArrayElement +_mesa_ColorPointer +_mesa_ColorPointerEXT +_mesa_DrawArrays +_mesa_DrawElements +_mesa_DrawRangeElements +_mesa_EdgeFlagPointer +_mesa_EdgeFlagPointerEXT +_mesa_IndexPointer +_mesa_IndexPointerEXT +_mesa_InterleavedArrays +_mesa_NormalPointer +_mesa_NormalPointerEXT +_mesa_TexCoordPointer +_mesa_TexCoordPointerEXT +_mesa_VertexPointer +_mesa_VertexPointerEXT +gl_exec_array_elements +gl_update_client_state +gl_immediate_alloc +gl_immediate_free +gl_vb_create_for_cva +gl_vb_create_for_immediate +gl_vb_free +gl_cull_vb +gl_dont_cull_vb +gl_fast_copy_vb +gl_make_normal_cullmask +gl_purge_vertices +_mesa_Begin +_mesa_Color3b +_mesa_Color3bv +_mesa_Color3d +_mesa_Color3dv +_mesa_Color3f +_mesa_Color3fv +_mesa_Color3i +_mesa_Color3iv +_mesa_Color3s +_mesa_Color3sv +_mesa_Color3ub +_mesa_Color3ubv +_mesa_Color3ui +_mesa_Color3uiv +_mesa_Color3us +_mesa_Color3usv +_mesa_Color4b +_mesa_Color4bv +_mesa_Color4d +_mesa_Color4dv +_mesa_Color4f +_mesa_Color4fv +_mesa_Color4i +_mesa_Color4iv +_mesa_Color4s +_mesa_Color4sv +_mesa_Color4ub +_mesa_Color4ubv +_mesa_Color4ui +_mesa_Color4uiv +_mesa_Color4us +_mesa_Color4usv +_mesa_EdgeFlag +_mesa_EdgeFlagv +_mesa_End +_mesa_Indexd +_mesa_Indexdv +_mesa_Indexf +_mesa_Indexfv +_mesa_Indexi +_mesa_Indexiv +_mesa_Indexs +_mesa_Indexsv +_mesa_Indexub +_mesa_Indexubv +_mesa_MultiTexCoord1dARB +_mesa_MultiTexCoord1dvARB +_mesa_MultiTexCoord1fARB +_mesa_MultiTexCoord1fvARB +_mesa_MultiTexCoord1iARB +_mesa_MultiTexCoord1ivARB +_mesa_MultiTexCoord1sARB +_mesa_MultiTexCoord1svARB +_mesa_MultiTexCoord2dARB +_mesa_MultiTexCoord2dvARB +_mesa_MultiTexCoord2fARB +_mesa_MultiTexCoord2fvARB +_mesa_MultiTexCoord2iARB +_mesa_MultiTexCoord2ivARB +_mesa_MultiTexCoord2sARB +_mesa_MultiTexCoord2svARB +_mesa_MultiTexCoord3dARB +_mesa_MultiTexCoord3dvARB +_mesa_MultiTexCoord3fARB +_mesa_MultiTexCoord3fvARB +_mesa_MultiTexCoord3iARB +_mesa_MultiTexCoord3ivARB +_mesa_MultiTexCoord3sARB +_mesa_MultiTexCoord3svARB +_mesa_MultiTexCoord4dARB +_mesa_MultiTexCoord4dvARB +_mesa_MultiTexCoord4fARB +_mesa_MultiTexCoord4fvARB +_mesa_MultiTexCoord4iARB +_mesa_MultiTexCoord4ivARB +_mesa_MultiTexCoord4sARB +_mesa_MultiTexCoord4svARB +_mesa_Normal3b +_mesa_Normal3bv +_mesa_Normal3d +_mesa_Normal3dv +_mesa_Normal3f +_mesa_Normal3fv +_mesa_Normal3i +_mesa_Normal3iv +_mesa_Normal3s +_mesa_Normal3sv +_mesa_TexCoord1d +_mesa_TexCoord1dv +_mesa_TexCoord1f +_mesa_TexCoord1fv +_mesa_TexCoord1i +_mesa_TexCoord1iv +_mesa_TexCoord1s +_mesa_TexCoord1sv +_mesa_TexCoord2d +_mesa_TexCoord2dv +_mesa_TexCoord2f +_mesa_TexCoord2fv +_mesa_TexCoord2i +_mesa_TexCoord2iv +_mesa_TexCoord2s +_mesa_TexCoord2sv +_mesa_TexCoord3d +_mesa_TexCoord3dv +_mesa_TexCoord3f +_mesa_TexCoord3fv +_mesa_TexCoord3i +_mesa_TexCoord3iv +_mesa_TexCoord3s +_mesa_TexCoord3sv +_mesa_TexCoord4d +_mesa_TexCoord4dv +_mesa_TexCoord4f +_mesa_TexCoord4fv +_mesa_TexCoord4i +_mesa_TexCoord4iv +_mesa_TexCoord4s +_mesa_TexCoord4sv +_mesa_Vertex2d +_mesa_Vertex2dv +_mesa_Vertex2f +_mesa_Vertex2fv +_mesa_Vertex2i +_mesa_Vertex2iv +_mesa_Vertex2s +_mesa_Vertex2sv +_mesa_Vertex3d +_mesa_Vertex3dv +_mesa_Vertex3f +_mesa_Vertex3fv +_mesa_Vertex3i +_mesa_Vertex3iv +_mesa_Vertex3s +_mesa_Vertex3sv +_mesa_Vertex4d +_mesa_Vertex4dv +_mesa_Vertex4f +_mesa_Vertex4fv +_mesa_Vertex4i +_mesa_Vertex4iv +_mesa_Vertex4s +_mesa_Vertex4sv +gl_Begin +gl_End +gl_Vertex2f +gl_render_elts +gl_render_vb_indirect +gl_init_vbrender +gl_reduced_prim_change +gl_render_clipped_line +gl_render_clipped_triangle +gl_render_vb +gl_set_render_vb_function +RESET_IMMEDIATE +gl_compute_orflag +gl_copy_prev_vertices +gl_copy_to_current +gl_execute_cassette +gl_fixup_cassette +gl_fixup_input +gl_flush_vb +gl_internal_flush +gl_maybe_transform_vb +gl_print_cassette +gl_print_cassette_flags +gl_reset_input +gl_reset_vb +gl_texcoord_size +gl_vector1ub_alloc +gl_vector1ub_free +gl_vector1ub_init +gl_vector1ui_alloc +gl_vector1ui_free +gl_vector1ui_init +gl_vector3f_alloc +gl_vector3f_free +gl_vector3f_init +gl_vector3f_print +gl_vector4f_alloc +gl_vector4f_clean_elem +gl_vector4f_free +gl_vector4f_init +gl_vector4f_print +gl_vector4ub_alloc +gl_vector4ub_free +gl_vector4ub_init +gl_init_vertices +_mesa_WindowPos2dMESA +_mesa_WindowPos2dvMESA +_mesa_WindowPos2fMESA +_mesa_WindowPos2fvMESA +_mesa_WindowPos2iMESA +_mesa_WindowPos2ivMESA +_mesa_WindowPos2sMESA +_mesa_WindowPos2svMESA +_mesa_WindowPos3dMESA +_mesa_WindowPos3dvMESA +_mesa_WindowPos3fMESA +_mesa_WindowPos3fvMESA +_mesa_WindowPos3iMESA +_mesa_WindowPos3ivMESA +_mesa_WindowPos3sMESA +_mesa_WindowPos3svMESA +_mesa_WindowPos4dMESA +_mesa_WindowPos4dvMESA +_mesa_WindowPos4fMESA +_mesa_WindowPos4fvMESA +_mesa_WindowPos4iMESA +_mesa_WindowPos4ivMESA +_mesa_WindowPos4sMESA +_mesa_WindowPos4svMESA +gl_init_transformation +gl_project_points +gl_transform_point_sz +gl_transform_vector +gl_write_zoomed_index_span +gl_write_zoomed_rgb_span +gl_write_zoomed_rgba_span +gl_write_zoomed_stencil_span +__glBitmap_size +__glCallLists_size +__glDrawPixels_size +__glFogfv_size +__glFogiv_size +__glLightModelfv_size +__glLightModeliv_size +__glLightfv_size +__glLightiv_size +__glMaterialfv_size +__glMaterialiv_size +__glTexEnvfv_size +__glTexEnviv_size +__glTexGendv_size +__glTexGenfv_size +__glTexGeniv_size +__glTexImage1D_size +__glTexImage2D_size +__glTexParameterfv_size +__glTexParameteriv_size +__MESA_beginDispatchOverride +__MESA_copyContext +__MESA_createBuffer +__MESA_createContext +__MESA_destroyBuffer +__MESA_destroyContext +__MESA_dispatchExec +__MESA_endDispatchOverride +__MESA_forceCurrent +__MESA_initVisuals +__MESA_loseCurrent +__MESA_makeCurrent +__MESA_notifyDestroy +__MESA_notifyResize +__MESA_notifySwapBuffers +__MESA_resetExtension +__MESA_resizeBuffers +__MESA_screenProbe +__MESA_setVisualConfigs +__MESA_shareContext +__MESA_swapBuffers +__glEvalComputeK +__glFloorLog2 +XMesaCreateImage +XMesaDestroyImage +XMesaGetPixel +XMesaPutImageHelper +XMesaCopySubBuffer +XMesaCreateContext +XMesaCreatePixmapBuffer +XMesaCreateVisual +XMesaCreateWindowBuffer +XMesaCreateWindowBuffer2 +XMesaDestroyBuffer +XMesaDestroyContext +XMesaDestroyVisual +XMesaDitherColor +XMesaFindBuffer +XMesaFlush +XMesaForceCurrent +XMesaGarbageCollect +XMesaGetBackBuffer +XMesaGetCurrentBuffer +XMesaGetCurrentContext +XMesaGetCurrentReadBuffer +XMesaGetDepthBuffer +XMesaGetString +XMesaLoseCurrent +XMesaMakeCurrent +XMesaMakeCurrent2 +XMesaReset +XMesaSetFXmode +XMesaSetVisualDisplay +XMesaSwapBuffers +XMesaUnbindContext +xmesa_alloc_back_buffer +xmesa_color_to_pixel +xmesa_update_state +xmesa_get_line_func +xmesa_get_points_func +xmesa_get_triangle_func + +/* $XFree86: xc/programs/Xserver/GL/mesa/src/GLcore-def.cpp,v 1.1 2000/08/10 17:40:29 dawes Exp $ */ diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile index 42eb72f67..59b2c4c14 100644 --- a/xc/programs/Xserver/GL/mesa/src/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.14 2000/06/17 00:03:13 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.15 2000/08/01 20:28:39 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -7,187 +7,187 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.14 2000/06/17 00:0 SUBDIRS = X -LinkSourceFile(aatriangle.c,../../../../../extras/Mesa/src) -LinkSourceFile(aatriangle.h,../../../../../extras/Mesa/src) -LinkSourceFile(aatritemp.h,../../../../../extras/Mesa/src) -LinkSourceFile(accum.c,../../../../../extras/Mesa/src) -LinkSourceFile(accum.h,../../../../../extras/Mesa/src) -LinkSourceFile(all.h,../../../../../extras/Mesa/src) -LinkSourceFile(alpha.c,../../../../../extras/Mesa/src) -LinkSourceFile(alpha.h,../../../../../extras/Mesa/src) -LinkSourceFile(alphabuf.c,../../../../../extras/Mesa/src) -LinkSourceFile(alphabuf.h,../../../../../extras/Mesa/src) -LinkSourceFile(attrib.c,../../../../../extras/Mesa/src) -LinkSourceFile(attrib.h,../../../../../extras/Mesa/src) -LinkSourceFile(bbox.c,../../../../../extras/Mesa/src) -LinkSourceFile(bbox.h,../../../../../extras/Mesa/src) -LinkSourceFile(bitmap.c,../../../../../extras/Mesa/src) -LinkSourceFile(bitmap.h,../../../../../extras/Mesa/src) -LinkSourceFile(blend.c,../../../../../extras/Mesa/src) -LinkSourceFile(blend.h,../../../../../extras/Mesa/src) -LinkSourceFile(buffers.c,../../../../../extras/Mesa/src) -LinkSourceFile(buffers.h,../../../../../extras/Mesa/src) -LinkSourceFile(clip.c,../../../../../extras/Mesa/src) -LinkSourceFile(clip.h,../../../../../extras/Mesa/src) -LinkSourceFile(clip_funcs.h,../../../../../extras/Mesa/src) -LinkSourceFile(clip_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(colortab.c,../../../../../extras/Mesa/src) -LinkSourceFile(colortab.h,../../../../../extras/Mesa/src) -LinkSourceFile(config.c,../../../../../extras/Mesa/src) -LinkSourceFile(config.h,../../../../../extras/Mesa/src) -LinkSourceFile(context.c,../../../../../extras/Mesa/src) -LinkSourceFile(context.h,../../../../../extras/Mesa/src) -LinkSourceFile(copy_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(copypix.c,../../../../../extras/Mesa/src) -LinkSourceFile(copypix.h,../../../../../extras/Mesa/src) -LinkSourceFile(cull_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(cva.c,../../../../../extras/Mesa/src) -LinkSourceFile(cva.h,../../../../../extras/Mesa/src) -LinkSourceFile(dd.h,../../../../../extras/Mesa/src) -LinkSourceFile(ddsample.c,../../../../../extras/Mesa/src) -LinkSourceFile(debug_xform.c,../../../../../extras/Mesa/src) -LinkSourceFile(debug_xform.h,../../../../../extras/Mesa/src) -LinkSourceFile(depth.c,../../../../../extras/Mesa/src) -LinkSourceFile(depth.h,../../../../../extras/Mesa/src) -LinkSourceFile(dispatch.c,../../../../../extras/Mesa/src) -LinkSourceFile(dlist.c,../../../../../extras/Mesa/src) -LinkSourceFile(dlist.h,../../../../../extras/Mesa/src) -LinkSourceFile(dotprod_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(drawpix.c,../../../../../extras/Mesa/src) -LinkSourceFile(drawpix.h,../../../../../extras/Mesa/src) -LinkSourceFile(enable.c,../../../../../extras/Mesa/src) -LinkSourceFile(enable.h,../../../../../extras/Mesa/src) -LinkSourceFile(enums.c,../../../../../extras/Mesa/src) -LinkSourceFile(enums.h,../../../../../extras/Mesa/src) -LinkSourceFile(eval.c,../../../../../extras/Mesa/src) -LinkSourceFile(eval.h,../../../../../extras/Mesa/src) -LinkSourceFile(extensions.c,../../../../../extras/Mesa/src) -LinkSourceFile(extensions.h,../../../../../extras/Mesa/src) -LinkSourceFile(feedback.c,../../../../../extras/Mesa/src) -LinkSourceFile(feedback.h,../../../../../extras/Mesa/src) -LinkSourceFile(fixed.h,../../../../../extras/Mesa/src) -LinkSourceFile(fog.c,../../../../../extras/Mesa/src) -LinkSourceFile(fog.h,../../../../../extras/Mesa/src) -LinkSourceFile(fog_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(general_clip.h,../../../../../extras/Mesa/src) -LinkSourceFile(get.c,../../../../../extras/Mesa/src) -LinkSourceFile(get.h,../../../../../extras/Mesa/src) -LinkSourceFile(glapi.h,../../../../../extras/Mesa/src) -LinkSourceFile(glapi.c,../../../../../extras/Mesa/src) -LinkSourceFile(glapioffsets.h,../../../../../extras/Mesa/src) -LinkSourceFile(glapinoop.c,../../../../../extras/Mesa/src) -LinkSourceFile(glapinoop.h,../../../../../extras/Mesa/src) -LinkSourceFile(glapitable.h,../../../../../extras/Mesa/src) -LinkSourceFile(glapitemp.h,../../../../../extras/Mesa/src) -LinkSourceFile(glheader.h,../../../../../extras/Mesa/src) -LinkSourceFile(glthread.c,../../../../../extras/Mesa/src) -LinkSourceFile(glthread.h,../../../../../extras/Mesa/src) -LinkSourceFile(hash.c,../../../../../extras/Mesa/src) -LinkSourceFile(hash.h,../../../../../extras/Mesa/src) -LinkSourceFile(hint.c,../../../../../extras/Mesa/src) -LinkSourceFile(hint.h,../../../../../extras/Mesa/src) -LinkSourceFile(highpc.c,../../../../../extras/Mesa/src) -LinkSourceFile(image.c,../../../../../extras/Mesa/src) -LinkSourceFile(image.h,../../../../../extras/Mesa/src) -LinkSourceFile(imaging.c,../../../../../extras/Mesa/src) -LinkSourceFile(imaging.h,../../../../../extras/Mesa/src) -LinkSourceFile(indirect_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(interp_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(light.c,../../../../../extras/Mesa/src) -LinkSourceFile(light.h,../../../../../extras/Mesa/src) -LinkSourceFile(lines.c,../../../../../extras/Mesa/src) -LinkSourceFile(lines.h,../../../../../extras/Mesa/src) -LinkSourceFile(linetemp.h,../../../../../extras/Mesa/src) -LinkSourceFile(lnaatemp.h,../../../../../extras/Mesa/src) -LinkSourceFile(logic.c,../../../../../extras/Mesa/src) -LinkSourceFile(logic.h,../../../../../extras/Mesa/src) -LinkSourceFile(lowpc.c,../../../../../extras/Mesa/src) -LinkSourceFile(macros.h,../../../../../extras/Mesa/src) -LinkSourceFile(masking.c,../../../../../extras/Mesa/src) -LinkSourceFile(masking.h,../../../../../extras/Mesa/src) -LinkSourceFile(matrix.c,../../../../../extras/Mesa/src) -LinkSourceFile(matrix.h,../../../../../extras/Mesa/src) -LinkSourceFile(mem.c,../../../../../extras/Mesa/src) -LinkSourceFile(mem.h,../../../../../extras/Mesa/src) -LinkSourceFile(mmath.c,../../../../../extras/Mesa/src) -LinkSourceFile(mmath.h,../../../../../extras/Mesa/src) -LinkSourceFile(norm_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(pb.c,../../../../../extras/Mesa/src) -LinkSourceFile(pb.h,../../../../../extras/Mesa/src) -LinkSourceFile(pipeline.c,../../../../../extras/Mesa/src) -LinkSourceFile(pipeline.h,../../../../../extras/Mesa/src) -LinkSourceFile(pixel.c,../../../../../extras/Mesa/src) -LinkSourceFile(pixel.h,../../../../../extras/Mesa/src) -LinkSourceFile(pixeltex.c,../../../../../extras/Mesa/src) -LinkSourceFile(pixeltex.h,../../../../../extras/Mesa/src) -LinkSourceFile(points.c,../../../../../extras/Mesa/src) -LinkSourceFile(points.h,../../../../../extras/Mesa/src) -LinkSourceFile(polygon.c,../../../../../extras/Mesa/src) -LinkSourceFile(polygon.h,../../../../../extras/Mesa/src) -LinkSourceFile(quads.c,../../../../../extras/Mesa/src) -LinkSourceFile(quads.h,../../../../../extras/Mesa/src) -LinkSourceFile(rastpos.c,../../../../../extras/Mesa/src) -LinkSourceFile(rastpos.h,../../../../../extras/Mesa/src) -LinkSourceFile(readpix.c,../../../../../extras/Mesa/src) -LinkSourceFile(readpix.h,../../../../../extras/Mesa/src) -LinkSourceFile(rect.c,../../../../../extras/Mesa/src) -LinkSourceFile(rect.h,../../../../../extras/Mesa/src) -LinkSourceFile(render_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(scissor.c,../../../../../extras/Mesa/src) -LinkSourceFile(scissor.h,../../../../../extras/Mesa/src) -LinkSourceFile(shade.c,../../../../../extras/Mesa/src) -LinkSourceFile(shade.h,../../../../../extras/Mesa/src) -LinkSourceFile(shade_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(simple_list.h,../../../../../extras/Mesa/src) -LinkSourceFile(span.c,../../../../../extras/Mesa/src) -LinkSourceFile(span.h,../../../../../extras/Mesa/src) -LinkSourceFile(stages.c,../../../../../extras/Mesa/src) -LinkSourceFile(stages.h,../../../../../extras/Mesa/src) -LinkSourceFile(state.c,../../../../../extras/Mesa/src) -LinkSourceFile(state.h,../../../../../extras/Mesa/src) -LinkSourceFile(stencil.c,../../../../../extras/Mesa/src) -LinkSourceFile(stencil.h,../../../../../extras/Mesa/src) -LinkSourceFile(texgen_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(teximage.c,../../../../../extras/Mesa/src) -LinkSourceFile(teximage.h,../../../../../extras/Mesa/src) -LinkSourceFile(texobj.c,../../../../../extras/Mesa/src) -LinkSourceFile(texobj.h,../../../../../extras/Mesa/src) -LinkSourceFile(texstate.c,../../../../../extras/Mesa/src) -LinkSourceFile(texstate.h,../../../../../extras/Mesa/src) -LinkSourceFile(texture.c,../../../../../extras/Mesa/src) -LinkSourceFile(texture.h,../../../../../extras/Mesa/src) -LinkSourceFile(trans_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(translate.c,../../../../../extras/Mesa/src) -LinkSourceFile(translate.h,../../../../../extras/Mesa/src) -LinkSourceFile(triangle.c,../../../../../extras/Mesa/src) -LinkSourceFile(triangle.h,../../../../../extras/Mesa/src) -LinkSourceFile(tritemp.h,../../../../../extras/Mesa/src) -LinkSourceFile(types.h,../../../../../extras/Mesa/src) -LinkSourceFile(varray.c,../../../../../extras/Mesa/src) -LinkSourceFile(varray.h,../../../../../extras/Mesa/src) -LinkSourceFile(vb.c,../../../../../extras/Mesa/src) -LinkSourceFile(vb.h,../../../../../extras/Mesa/src) -LinkSourceFile(vbcull.c,../../../../../extras/Mesa/src) -LinkSourceFile(vbcull.h,../../../../../extras/Mesa/src) -LinkSourceFile(vbfill.c,../../../../../extras/Mesa/src) -LinkSourceFile(vbfill.h,../../../../../extras/Mesa/src) -LinkSourceFile(vbindirect.c,../../../../../extras/Mesa/src) -LinkSourceFile(vbindirect.h,../../../../../extras/Mesa/src) -LinkSourceFile(vbrender.c,../../../../../extras/Mesa/src) -LinkSourceFile(vbrender.h,../../../../../extras/Mesa/src) -LinkSourceFile(vbxform.c,../../../../../extras/Mesa/src) -LinkSourceFile(vbxform.h,../../../../../extras/Mesa/src) -LinkSourceFile(vector.c,../../../../../extras/Mesa/src) -LinkSourceFile(vector.h,../../../../../extras/Mesa/src) -LinkSourceFile(vertices.c,../../../../../extras/Mesa/src) -LinkSourceFile(vertices.h,../../../../../extras/Mesa/src) -LinkSourceFile(winpos.c,../../../../../extras/Mesa/src) -LinkSourceFile(winpos.h,../../../../../extras/Mesa/src) -LinkSourceFile(xform.c,../../../../../extras/Mesa/src) -LinkSourceFile(xform.h,../../../../../extras/Mesa/src) -LinkSourceFile(xform_tmp.h,../../../../../extras/Mesa/src) -LinkSourceFile(zoom.c,../../../../../extras/Mesa/src) -LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) +LinkSourceFile(aatriangle.c,$(MESASRCDIR)/src) +LinkSourceFile(aatriangle.h,$(MESASRCDIR)/src) +LinkSourceFile(aatritemp.h,$(MESASRCDIR)/src) +LinkSourceFile(accum.c,$(MESASRCDIR)/src) +LinkSourceFile(accum.h,$(MESASRCDIR)/src) +LinkSourceFile(all.h,$(MESASRCDIR)/src) +LinkSourceFile(alpha.c,$(MESASRCDIR)/src) +LinkSourceFile(alpha.h,$(MESASRCDIR)/src) +LinkSourceFile(alphabuf.c,$(MESASRCDIR)/src) +LinkSourceFile(alphabuf.h,$(MESASRCDIR)/src) +LinkSourceFile(attrib.c,$(MESASRCDIR)/src) +LinkSourceFile(attrib.h,$(MESASRCDIR)/src) +LinkSourceFile(bbox.c,$(MESASRCDIR)/src) +LinkSourceFile(bbox.h,$(MESASRCDIR)/src) +LinkSourceFile(bitmap.c,$(MESASRCDIR)/src) +LinkSourceFile(bitmap.h,$(MESASRCDIR)/src) +LinkSourceFile(blend.c,$(MESASRCDIR)/src) +LinkSourceFile(blend.h,$(MESASRCDIR)/src) +LinkSourceFile(buffers.c,$(MESASRCDIR)/src) +LinkSourceFile(buffers.h,$(MESASRCDIR)/src) +LinkSourceFile(clip.c,$(MESASRCDIR)/src) +LinkSourceFile(clip.h,$(MESASRCDIR)/src) +LinkSourceFile(clip_funcs.h,$(MESASRCDIR)/src) +LinkSourceFile(clip_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(colortab.c,$(MESASRCDIR)/src) +LinkSourceFile(colortab.h,$(MESASRCDIR)/src) +LinkSourceFile(config.c,$(MESASRCDIR)/src) +LinkSourceFile(config.h,$(MESASRCDIR)/src) +LinkSourceFile(context.c,$(MESASRCDIR)/src) +LinkSourceFile(context.h,$(MESASRCDIR)/src) +LinkSourceFile(copy_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(copypix.c,$(MESASRCDIR)/src) +LinkSourceFile(copypix.h,$(MESASRCDIR)/src) +LinkSourceFile(cull_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(cva.c,$(MESASRCDIR)/src) +LinkSourceFile(cva.h,$(MESASRCDIR)/src) +LinkSourceFile(dd.h,$(MESASRCDIR)/src) +LinkSourceFile(ddsample.c,$(MESASRCDIR)/src) +LinkSourceFile(debug_xform.c,$(MESASRCDIR)/src) +LinkSourceFile(debug_xform.h,$(MESASRCDIR)/src) +LinkSourceFile(depth.c,$(MESASRCDIR)/src) +LinkSourceFile(depth.h,$(MESASRCDIR)/src) +LinkSourceFile(dispatch.c,$(MESASRCDIR)/src) +LinkSourceFile(dlist.c,$(MESASRCDIR)/src) +LinkSourceFile(dlist.h,$(MESASRCDIR)/src) +LinkSourceFile(dotprod_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(drawpix.c,$(MESASRCDIR)/src) +LinkSourceFile(drawpix.h,$(MESASRCDIR)/src) +LinkSourceFile(enable.c,$(MESASRCDIR)/src) +LinkSourceFile(enable.h,$(MESASRCDIR)/src) +LinkSourceFile(enums.c,$(MESASRCDIR)/src) +LinkSourceFile(enums.h,$(MESASRCDIR)/src) +LinkSourceFile(eval.c,$(MESASRCDIR)/src) +LinkSourceFile(eval.h,$(MESASRCDIR)/src) +LinkSourceFile(extensions.c,$(MESASRCDIR)/src) +LinkSourceFile(extensions.h,$(MESASRCDIR)/src) +LinkSourceFile(feedback.c,$(MESASRCDIR)/src) +LinkSourceFile(feedback.h,$(MESASRCDIR)/src) +LinkSourceFile(fixed.h,$(MESASRCDIR)/src) +LinkSourceFile(fog.c,$(MESASRCDIR)/src) +LinkSourceFile(fog.h,$(MESASRCDIR)/src) +LinkSourceFile(fog_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(general_clip.h,$(MESASRCDIR)/src) +LinkSourceFile(get.c,$(MESASRCDIR)/src) +LinkSourceFile(get.h,$(MESASRCDIR)/src) +LinkSourceFile(glapi.h,$(MESASRCDIR)/src) +LinkSourceFile(glapi.c,$(MESASRCDIR)/src) +LinkSourceFile(glapioffsets.h,$(MESASRCDIR)/src) +LinkSourceFile(glapinoop.c,$(MESASRCDIR)/src) +LinkSourceFile(glapinoop.h,$(MESASRCDIR)/src) +LinkSourceFile(glapitable.h,$(MESASRCDIR)/src) +LinkSourceFile(glapitemp.h,$(MESASRCDIR)/src) +LinkSourceFile(glheader.h,$(MESASRCDIR)/src) +LinkSourceFile(glthread.c,$(MESASRCDIR)/src) +LinkSourceFile(glthread.h,$(MESASRCDIR)/src) +LinkSourceFile(hash.c,$(MESASRCDIR)/src) +LinkSourceFile(hash.h,$(MESASRCDIR)/src) +LinkSourceFile(hint.c,$(MESASRCDIR)/src) +LinkSourceFile(hint.h,$(MESASRCDIR)/src) +LinkSourceFile(highpc.c,$(MESASRCDIR)/src) +LinkSourceFile(image.c,$(MESASRCDIR)/src) +LinkSourceFile(image.h,$(MESASRCDIR)/src) +LinkSourceFile(imaging.c,$(MESASRCDIR)/src) +LinkSourceFile(imaging.h,$(MESASRCDIR)/src) +LinkSourceFile(indirect_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(interp_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(light.c,$(MESASRCDIR)/src) +LinkSourceFile(light.h,$(MESASRCDIR)/src) +LinkSourceFile(lines.c,$(MESASRCDIR)/src) +LinkSourceFile(lines.h,$(MESASRCDIR)/src) +LinkSourceFile(linetemp.h,$(MESASRCDIR)/src) +LinkSourceFile(lnaatemp.h,$(MESASRCDIR)/src) +LinkSourceFile(logic.c,$(MESASRCDIR)/src) +LinkSourceFile(logic.h,$(MESASRCDIR)/src) +LinkSourceFile(lowpc.c,$(MESASRCDIR)/src) +LinkSourceFile(macros.h,$(MESASRCDIR)/src) +LinkSourceFile(masking.c,$(MESASRCDIR)/src) +LinkSourceFile(masking.h,$(MESASRCDIR)/src) +LinkSourceFile(matrix.c,$(MESASRCDIR)/src) +LinkSourceFile(matrix.h,$(MESASRCDIR)/src) +LinkSourceFile(mem.c,$(MESASRCDIR)/src) +LinkSourceFile(mem.h,$(MESASRCDIR)/src) +LinkSourceFile(mmath.c,$(MESASRCDIR)/src) +LinkSourceFile(mmath.h,$(MESASRCDIR)/src) +LinkSourceFile(norm_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(pb.c,$(MESASRCDIR)/src) +LinkSourceFile(pb.h,$(MESASRCDIR)/src) +LinkSourceFile(pipeline.c,$(MESASRCDIR)/src) +LinkSourceFile(pipeline.h,$(MESASRCDIR)/src) +LinkSourceFile(pixel.c,$(MESASRCDIR)/src) +LinkSourceFile(pixel.h,$(MESASRCDIR)/src) +LinkSourceFile(pixeltex.c,$(MESASRCDIR)/src) +LinkSourceFile(pixeltex.h,$(MESASRCDIR)/src) +LinkSourceFile(points.c,$(MESASRCDIR)/src) +LinkSourceFile(points.h,$(MESASRCDIR)/src) +LinkSourceFile(polygon.c,$(MESASRCDIR)/src) +LinkSourceFile(polygon.h,$(MESASRCDIR)/src) +LinkSourceFile(quads.c,$(MESASRCDIR)/src) +LinkSourceFile(quads.h,$(MESASRCDIR)/src) +LinkSourceFile(rastpos.c,$(MESASRCDIR)/src) +LinkSourceFile(rastpos.h,$(MESASRCDIR)/src) +LinkSourceFile(readpix.c,$(MESASRCDIR)/src) +LinkSourceFile(readpix.h,$(MESASRCDIR)/src) +LinkSourceFile(rect.c,$(MESASRCDIR)/src) +LinkSourceFile(rect.h,$(MESASRCDIR)/src) +LinkSourceFile(render_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(scissor.c,$(MESASRCDIR)/src) +LinkSourceFile(scissor.h,$(MESASRCDIR)/src) +LinkSourceFile(shade.c,$(MESASRCDIR)/src) +LinkSourceFile(shade.h,$(MESASRCDIR)/src) +LinkSourceFile(shade_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(simple_list.h,$(MESASRCDIR)/src) +LinkSourceFile(span.c,$(MESASRCDIR)/src) +LinkSourceFile(span.h,$(MESASRCDIR)/src) +LinkSourceFile(stages.c,$(MESASRCDIR)/src) +LinkSourceFile(stages.h,$(MESASRCDIR)/src) +LinkSourceFile(state.c,$(MESASRCDIR)/src) +LinkSourceFile(state.h,$(MESASRCDIR)/src) +LinkSourceFile(stencil.c,$(MESASRCDIR)/src) +LinkSourceFile(stencil.h,$(MESASRCDIR)/src) +LinkSourceFile(texgen_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(teximage.c,$(MESASRCDIR)/src) +LinkSourceFile(teximage.h,$(MESASRCDIR)/src) +LinkSourceFile(texobj.c,$(MESASRCDIR)/src) +LinkSourceFile(texobj.h,$(MESASRCDIR)/src) +LinkSourceFile(texstate.c,$(MESASRCDIR)/src) +LinkSourceFile(texstate.h,$(MESASRCDIR)/src) +LinkSourceFile(texture.c,$(MESASRCDIR)/src) +LinkSourceFile(texture.h,$(MESASRCDIR)/src) +LinkSourceFile(trans_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(translate.c,$(MESASRCDIR)/src) +LinkSourceFile(translate.h,$(MESASRCDIR)/src) +LinkSourceFile(triangle.c,$(MESASRCDIR)/src) +LinkSourceFile(triangle.h,$(MESASRCDIR)/src) +LinkSourceFile(tritemp.h,$(MESASRCDIR)/src) +LinkSourceFile(types.h,$(MESASRCDIR)/src) +LinkSourceFile(varray.c,$(MESASRCDIR)/src) +LinkSourceFile(varray.h,$(MESASRCDIR)/src) +LinkSourceFile(vb.c,$(MESASRCDIR)/src) +LinkSourceFile(vb.h,$(MESASRCDIR)/src) +LinkSourceFile(vbcull.c,$(MESASRCDIR)/src) +LinkSourceFile(vbcull.h,$(MESASRCDIR)/src) +LinkSourceFile(vbfill.c,$(MESASRCDIR)/src) +LinkSourceFile(vbfill.h,$(MESASRCDIR)/src) +LinkSourceFile(vbindirect.c,$(MESASRCDIR)/src) +LinkSourceFile(vbindirect.h,$(MESASRCDIR)/src) +LinkSourceFile(vbrender.c,$(MESASRCDIR)/src) +LinkSourceFile(vbrender.h,$(MESASRCDIR)/src) +LinkSourceFile(vbxform.c,$(MESASRCDIR)/src) +LinkSourceFile(vbxform.h,$(MESASRCDIR)/src) +LinkSourceFile(vector.c,$(MESASRCDIR)/src) +LinkSourceFile(vector.h,$(MESASRCDIR)/src) +LinkSourceFile(vertices.c,$(MESASRCDIR)/src) +LinkSourceFile(vertices.h,$(MESASRCDIR)/src) +LinkSourceFile(winpos.c,$(MESASRCDIR)/src) +LinkSourceFile(winpos.h,$(MESASRCDIR)/src) +LinkSourceFile(xform.c,$(MESASRCDIR)/src) +LinkSourceFile(xform.h,$(MESASRCDIR)/src) +LinkSourceFile(xform_tmp.h,$(MESASRCDIR)/src) +LinkSourceFile(zoom.c,$(MESASRCDIR)/src) +LinkSourceFile(zoom.h,$(MESASRCDIR)/src) CORE_SRCS = aatriangle.c \ accum.c \ diff --git a/xc/programs/Xserver/GL/mesa/src/X/Imakefile b/xc/programs/Xserver/GL/mesa/src/X/Imakefile index 83d864cb7..7704ffecc 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/X/Imakefile @@ -1,17 +1,17 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.7 2000/02/23 04:46:56 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.8 2000/08/01 20:28:40 dawes Exp $ #define IHaveModules #include <Server.tmpl> -LinkSourceFile(xmesa1.c,../../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa2.c,../../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa3.c,../../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesa4.c,../../../../../../extras/Mesa/src/X) -LinkSourceFile(xmesaP.h,../../../../../../extras/Mesa/src/X) -LinkSourceFile(glxheader.h,../../../../../../extras/Mesa/src/X) +LinkSourceFile(xmesa1.c,$(MESASRCDIR)/src/X) +LinkSourceFile(xmesa2.c,$(MESASRCDIR)/src/X) +LinkSourceFile(xmesa3.c,$(MESASRCDIR)/src/X) +LinkSourceFile(xmesa4.c,$(MESASRCDIR)/src/X) +LinkSourceFile(xmesaP.h,$(MESASRCDIR)/src/X) +LinkSourceFile(glxheader.h,$(MESASRCDIR)/src/X) -LinkSourceFile(compsize.c,../../../../../../lib/GL/glx) -LinkSourceFile(size.h,../../../../../../lib/GL/glx) +LinkSourceFile(compsize.c,$(LIBSRC)/GL/glx) +LinkSourceFile(size.h,$(LIBSRC)/GL/glx) DRIVER_SRCS = xmesa1.c xmesa2.c xmesa3.c xmesa4.c DRIVER_OBJS = xmesa1.o xmesa2.o xmesa3.o xmesa4.o diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h index ba9a04f9d..0716d6c7d 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h +++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.4 2000/03/02 16:07:39 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.5 2000/08/10 17:40:29 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -35,6 +35,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _XF86GLX_UTIL_H_ #define _XF86GLX_UTIL_H_ +#ifdef __CYGWIN__ +#undef WIN32 +#undef _WIN32 +#endif + #include <screenint.h> #include <pixmap.h> #include <gc.h> diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 9e28fb7c6..bcccf3203 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -2,7 +2,7 @@ XCOMM $TOG: Imakefile /main/249 1997/12/11 11:18:14 kaleb $ /* * Server Master Makefile */ -XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.184 2000/06/17 00:03:10 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.186 2000/08/11 17:25:02 dawes Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -533,8 +533,11 @@ XNEST = Xnest #if XVirtualFramebufferServer && !MakeDllModules XVFB = Xvfb #endif -#if defined(XF86Server) || (!MakeDllModules && (defined(XnestServer) || defined(XVirtualFramebufferServer))) -MakeMutex($(XF86SERVER) $(XNEST) $(XVFB)) +#if XWinServer && !MakeDllModules +XWIN = XWin +#endif +#if defined(XF86Server) || (!MakeDllModules && (defined(XnestServer) || defined(XVirtualFramebufferServer) || defined(XWinServer))) +MakeMutex($(XF86SERVER) $(XNEST) $(XVFB) $(XWIN)) #endif MakeMutex($(STDDIRS) mfb fb cfb cfb16 cfb24 cfb32) #endif @@ -980,21 +983,21 @@ CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 -#ifndef Win32Architecture -XVFBDDXDIR = hw/vfb -#else +#if defined(Win32Architecture) XVFBDDXDIR = hw +#else +XVFBDDXDIR = hw/vfb #endif XVFBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XVFBDDXDIR) $(DEPDIRS) #ifndef Win32Architecture #if BuildDPMS -XVFBDPMSSTUBOBJS = hw/vfb/dpmsstubs.o +XVFBDPMSSTUBOBJS = $(XVFBDDXDIR)/dpmsstubs.o #endif -XVFBOBJS = hw/vfb/stubs.o hw/vfb/miinitext.o $(XVFBDPMSSTUBOBJS) +XVFBOBJS = $(XVFBDDXDIR)/stubs.o $(XVFBDDXDIR)/miinitext.o $(XVFBDPMSSTUBOBJS) #else XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o #endif -XVFB = hw/vfb/LibraryTargetName(vfb) +XVFB = $(XVFBDDXDIR)/LibraryTargetName(vfb) #if DoLoadableServer XVFBLIBS = PreFbLibs $(XVFB) $(CFB) PostFbLibs $(MI) #else @@ -1013,6 +1016,45 @@ ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS), \ #endif /* XVirtualFramebufferServer */ +#if XWinServer && !MakeDllModules +XCOMM +XCOMM server with DirectX framebuffer for Windows +XCOMM +MFBDIR = mfb +CFB8DIR = cfb +CFB16DIR = cfb16 +CFB24DIR = cfb24 +CFB32DIR = cfb32 +#ifndef Win32Architecture +XWINDDXDIR = hw/xwin +#else +XWINDDXDIR = hw +#endif +XWINDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XWINDDXDIR) $(DEPDIRS) +#if BuildDPMS +XWINOBJS = hw/xwin/InitInput.o hw/xwin/InitOutput.o hw/xwin/stubs.o hw/xwin/directx.o hw/xwin/dpmsstubs.o dix/main.o hw/xwin/ntux_xf.o +#else +XWINOBJS = hw/xwin/InitInput.o hw/xwin/InitOutput.o hw/xwin/stubs.o hw/xwin/directx.o dix/main.o hw/xwin/ntux_xf.o +#endif +XWIN = hw/xwin/LibraryTargetName(XWin) +XWINLIBS = PreFbLibs $(XWIN) $(CFB) PostFbLibs $(MI) $(SURFLIB) +XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) +#if HasParallelMake +MakeMutex($(XWINDIRS) $(XWINOBJS) $(XWIN) $(XWINLIBS) $(XWINSYSLIBS)) +#endif +#if ForceServerRemake +$(XWINOBJS) $(XWIN) $(XWINLIBS) $(XWINSYSLIBS):: $(XWINDIRS) + @if [ -f $@ ]; then touch $@; fi +#endif +ServerTarget(XWin,$(XWINDIRS),$(XWINOBJS), \ + $(XWINLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XWINSYSLIBS)) + +#ifndef ServerToInstall +#define ServerToInstall XWin +#endif +#endif /* XWinServer */ + + CFBDIRS = $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) DDXDIRS = $(DDXDIR1) $(DDXDIR2) $(DDXDIR3) $(XVFBDDXDIR) $(XNESTDDXDIR) diff --git a/xc/programs/Xserver/PEX5/ospex/osPexFont.c b/xc/programs/Xserver/PEX5/ospex/osPexFont.c index 00fd08556..bde39bbbb 100644 --- a/xc/programs/Xserver/PEX5/ospex/osPexFont.c +++ b/xc/programs/Xserver/PEX5/ospex/osPexFont.c @@ -42,7 +42,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/PEX5/ospex/osPexFont.c,v 3.15 1998/10/04 09:35:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/PEX5/ospex/osPexFont.c,v 3.16 2000/08/10 17:40:30 dawes Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ @@ -65,13 +65,7 @@ SOFTWARE. #ifndef XFree86LOADER -#ifndef X_NOT_POSIX -#include <dirent.h> -#else -#ifdef SYSV -#include <dirent.h> -#else -#ifdef USG +#if !defined(X_NOT_POSIX) || defined(SYSV) || defined(__CYGWIN__) || defined(USG) #include <dirent.h> #else #include <sys/dir.h> @@ -79,8 +73,6 @@ SOFTWARE. #define dirent direct #endif #endif -#endif -#endif typedef struct dirent ENTRY; #ifndef FILENAME_MAX diff --git a/xc/programs/Xserver/Xext/Imakefile b/xc/programs/Xserver/Xext/Imakefile index b53229a18..e70e39457 100644 --- a/xc/programs/Xserver/Xext/Imakefile +++ b/xc/programs/Xserver/Xext/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/63 1997/11/24 16:48:40 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.33 2000/06/15 20:49:59 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.35 2000/08/09 02:57:20 tsi Exp $ #include <Server.tmpl> @@ -60,12 +60,6 @@ XF86BIGFOBJS = xf86bigfont.o XVOBJS = xvmain.o xvdisp.o #endif -#if BuildXantiExt - XANTISRCS = anti.c - XANTIOBJS = anti.o -#endif - - #if BuildAppgroup APPGROUPSRCS = appgroup.c APPGROUPOBJS = appgroup.o @@ -104,14 +98,14 @@ XF86BIGFOBJS = xf86bigfont.o bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \ $(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \ $(APPGROUPSRCS) xprint.c $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \ - $(EVISRCS) $(XVSRCS) $(XANTISRCS) $(FONTCACHESRCS) + $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \ mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \ $(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \ $(APPGROUPOBJS) xprint.o $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \ - $(EVIOBJS) $(XVOBJS) $(XANTIOBJS) $(FONTCACHEOBJS) + $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) xprint.o \ xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \ @@ -129,10 +123,9 @@ XF86INCLUDES = -I$(XF86COMSRC) NormalLibraryObjectRule() /* - * A hack to work around an optimisation problem with the compiler on - * FreeBSD 4.0-current in late 1999/early 2000. + * A hack to work around an optimization problem with gcc 2.95.2 */ -#if BuildXF86VidModeExt && defined(FreeBSDGccOptBug) +#if BuildXF86VidModeExt && defined(GccOptBug295) SpecialCObjectRule(xf86vmode,NullParameter,-O0) #endif diff --git a/xc/programs/Xserver/Xext/appgroup.c b/xc/programs/Xserver/Xext/appgroup.c index 0677682e2..c626799b7 100644 --- a/xc/programs/Xserver/Xext/appgroup.c +++ b/xc/programs/Xserver/Xext/appgroup.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.3 2000/08/11 23:59:47 dawes Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -559,7 +560,7 @@ int ProcXagCreateAssoc (client) if (stuff->window_type != XagWindowTypeX11) #endif return BadMatch; -#ifdef WIN32 /* and Mac, etc */ +#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */ if (!LocalClient (client)) return BadAccess; #endif diff --git a/xc/programs/Xserver/Xext/dpms.c b/xc/programs/Xserver/Xext/dpms.c index 3f9d2b370..17f5f59f7 100644 --- a/xc/programs/Xserver/Xext/dpms.c +++ b/xc/programs/Xserver/Xext/dpms.c @@ -32,7 +32,7 @@ Equipment Corporation. * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00 */ -/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.6 1999/03/07 11:40:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.7 2000/08/11 21:12:43 dawes Exp $ */ #include "X.h" #include "Xproto.h" @@ -115,6 +115,7 @@ ProcDPMSCapable(register ClientPtr client) { REQUEST(xDPMSCapableReq); xDPMSCapableReply rep; + register int n; REQUEST_SIZE_MATCH(xDPMSCapableReq); @@ -123,6 +124,9 @@ ProcDPMSCapable(register ClientPtr client) rep.sequenceNumber = client->sequence; rep.capable = DPMSCapableFlag; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + } WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep); return(client->noClientException); } diff --git a/xc/programs/Xserver/Xext/extmod/Imakefile b/xc/programs/Xserver/Xext/extmod/Imakefile index f2dcff79a..bbd67bb71 100644 --- a/xc/programs/Xserver/Xext/extmod/Imakefile +++ b/xc/programs/Xserver/Xext/extmod/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.17 2000/02/13 06:15:31 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.19 2000/08/09 03:06:55 tsi Exp $ XCOMM This directory is only entered if DoLoadableServer is set #define IHaveModules @@ -58,12 +58,6 @@ LinkSourceFile(xvdisp.c,..) LinkSourceFile(xvmod.c,..) #endif -#if BuildXantiExt - XANTISRCS = anti.c - XANTIOBJS = anti.o -LinkSourceFile(anti.c,..) -#endif - #if BuildEVI EVISRCS = EVI.c sampleEVI.c EVIOBJS = EVI.o sampleEVI.o @@ -85,13 +79,13 @@ LinkSourceFile(cup.c,..) bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \ $(XF86MISCSRCS) $(XF86DGASRCS) \ $(CUPSRCS) $(DPMSSRCS) $(FONTCACHESRCS) \ - $(EVISRCS) $(XVSRCS) $(XANTISRCS) $(MODINITSRCS) + $(EVISRCS) $(XVSRCS) $(MODINITSRCS) MOBJS = $(MODINITOBJS) shape.o $(MULTIBUFOBJ) mitmisc.o \ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o \ $(VIDMODEOBJS) $(XF86MISCOBJS) $(XF86DGAOBJS) \ $(CUPOBJS) $(DPMSOBJS) $(FONTCACHEOBJS) \ - $(EVIOBJS) $(XVOBJS) $(XANTIOBJS) + $(EVIOBJS) $(XVOBJS) DEFINES = -DEXTMODULE @@ -109,10 +103,9 @@ LinkSourceFile(xcmisc.c,..) ModuleObjectRule() /* - * A hack to work around an optimisation problem with the compiler on - * FreeBSD 4.0-current in late 1999/early 2000. + * A hack to work around an optimization problem with gcc 2.95.2 */ -#if BuildXF86VidModeExt && defined(FreeBSDGccOptBug) +#if BuildXF86VidModeExt && defined(GccOptBug295) SpecialCObjectRule(xf86vmode,NullParameter,-O0) #endif diff --git a/xc/programs/Xserver/Xext/extmod/modinit.c b/xc/programs/Xserver/Xext/extmod/modinit.c index c5bd67a5b..6d999b3b1 100644 --- a/xc/programs/Xserver/Xext/extmod/modinit.c +++ b/xc/programs/Xserver/Xext/extmod/modinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.c,v 1.13 2000/02/13 06:15:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.c,v 1.14 2000/08/09 03:06:55 tsi Exp $ */ /* * @@ -114,11 +114,6 @@ extern void FontCacheExtensionInit(INITARGS); #include "fontcachstr.h" #endif -#ifdef XANTI -extern void XAntiExtensionInit(INITARGS); -#include "XAntiproto.h" -#endif - #ifdef TOGCUP extern void XcupExtensionInit(INITARGS); #define _XCUP_SERVER_ @@ -284,15 +279,6 @@ ExtensionModule extensionModules[] = { NULL }, #endif -#ifdef XANTI - { - XAntiExtensionInit, - XAntiName, - NULL, - NULL, - NULL - }, -#endif { /* DON'T delete this entry ! */ NULL, NULL, diff --git a/xc/programs/Xserver/Xext/security.c b/xc/programs/Xserver/Xext/security.c index a5cf7b66a..316770eec 100644 --- a/xc/programs/Xserver/Xext/security.c +++ b/xc/programs/Xserver/Xext/security.c @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.4 1998/10/04 09:36:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.5 2000/08/10 17:40:30 dawes Exp $ */ #include "dixstruct.h" #include "extnsionst.h" @@ -47,7 +47,7 @@ extern unsigned char LbxReqCode; #ifndef DEFAULTPOLICYFILE # define DEFAULTPOLICYFILE NULL #endif -#ifdef WIN32 +#if defined(WIN32) || defined(__CYGWIN__) #include <X11/Xos.h> #undef index #endif diff --git a/xc/programs/Xserver/Xext/shm.c b/xc/programs/Xserver/Xext/shm.c index b8ec5e074..eb96a4e58 100644 --- a/xc/programs/Xserver/Xext/shm.c +++ b/xc/programs/Xserver/Xext/shm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.26 2000/04/27 16:26:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.27 2000/08/10 17:40:30 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -27,7 +27,11 @@ in this Software without prior written authorization from The Open Group. #include <sys/types.h> #ifndef Lynx +#ifndef __CYGWIN__ #include <sys/ipc.h> +#else +#include <sys/cygipc.h> +#endif #include <sys/shm.h> #else #include <ipc.h> diff --git a/xc/programs/Xserver/Xext/xf86bigfont.c b/xc/programs/Xserver/Xext/xf86bigfont.c index 443fc8d24..3fea6e3f8 100644 --- a/xc/programs/Xserver/Xext/xf86bigfont.c +++ b/xc/programs/Xserver/Xext/xf86bigfont.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.9 2000/06/22 16:59:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.10 2000/08/10 17:40:30 dawes Exp $ */ /* * BIGFONT extension for sharing font metrics between clients (if possible) * and for transmitting font metrics to clients in a compressed form. @@ -46,7 +46,7 @@ #ifdef SVR4 #include <sys/sysmacros.h> #endif -#ifdef ISC +#if defined(ISC) || defined(__CYGWIN__) #include <sys/param.h> #include <sys/sysmacros.h> #endif @@ -98,7 +98,7 @@ static int FontShmdescIndex; static unsigned int pagesize; -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) #include <sys/signal.h> diff --git a/xc/programs/Xserver/Xext/xvdisp.c b/xc/programs/Xserver/Xext/xvdisp.c index 5f85d5f9b..2d58d8b50 100644 --- a/xc/programs/Xserver/Xext/xvdisp.c +++ b/xc/programs/Xserver/Xext/xvdisp.c @@ -21,7 +21,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.15 2000/06/10 22:00:26 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.16 2000/08/10 17:40:30 dawes Exp $ */ /* ** File: @@ -61,8 +61,10 @@ SOFTWARE. #include "Xv.h" #include "Xvproto.h" #include "xvdix.h" +#ifdef MITSHM #define _XSHM_SERVER_ #include "shmstr.h" +#endif #ifdef EXTMODULE #include "xf86_ansic.h" @@ -73,7 +75,9 @@ SOFTWARE. #include "panoramiXsrv.h" XvAdaptorPtr XineramaAdaptors[MAXSCREENS]; +#ifdef MITSHM static int XineramaXvShmPutImage(ClientPtr); +#endif static int XineramaXvPutImage(ClientPtr); static int XineramaXvSetPortAttribute(ClientPtr); static int XineramaXvStopVideo(ClientPtr); @@ -98,7 +102,9 @@ static int ProcXvGetPortAttribute(ClientPtr); static int ProcXvQueryBestSize(ClientPtr); static int ProcXvQueryPortAttributes(ClientPtr); static int ProcXvPutImage(ClientPtr); +#ifdef MITSHM static int ProcXvShmPutImage(ClientPtr); +#endif static int ProcXvQueryImageAttributes(ClientPtr); static int ProcXvListImageFormats(ClientPtr); @@ -119,7 +125,9 @@ static int SProcXvGetPortAttribute(ClientPtr); static int SProcXvQueryBestSize(ClientPtr); static int SProcXvQueryPortAttributes(ClientPtr); static int SProcXvPutImage(ClientPtr); +#ifdef MITSHM static int SProcXvShmPutImage(ClientPtr); +#endif static int SProcXvQueryImageAttributes(ClientPtr); static int SProcXvListImageFormats(ClientPtr); @@ -250,6 +258,7 @@ ProcXvDispatch(ClientPtr client) else #endif return(ProcXvPutImage(client)); +#ifdef MITSHM case xv_ShmPutImage: #ifdef PANORAMIX if(!noPanoramiXExtension) @@ -257,6 +266,7 @@ ProcXvDispatch(ClientPtr client) else #endif return(ProcXvShmPutImage(client)); +#endif case xv_QueryImageAttributes: return(ProcXvQueryImageAttributes(client)); case xv_ListImageFormats: return(ProcXvListImageFormats(client)); default: @@ -300,7 +310,9 @@ SProcXvDispatch(ClientPtr client) case xv_QueryBestSize: return(SProcXvQueryBestSize(client)); case xv_QueryPortAttributes: return(SProcXvQueryPortAttributes(client)); case xv_PutImage: return(SProcXvPutImage(client)); +#ifdef MITSHM case xv_ShmPutImage: return(SProcXvShmPutImage(client)); +#endif case xv_QueryImageAttributes: return(SProcXvQueryImageAttributes(client)); case xv_ListImageFormats: return(SProcXvListImageFormats(client)); default: @@ -1069,6 +1081,7 @@ ProcXvPutImage(ClientPtr client) stuff->width, stuff->height); } +#ifdef MITSHM /* redefined here since it's not in any header file */ typedef struct _ShmDesc { struct _ShmDesc *next; @@ -1170,6 +1183,7 @@ ProcXvShmPutImage(ClientPtr client) return status; } +#endif static int @@ -1446,6 +1460,7 @@ SProcXvPutImage(ClientPtr client) return ProcXvPutImage(client); } +#ifdef MITSHM static int SProcXvShmPutImage(ClientPtr client) { @@ -1470,6 +1485,7 @@ SProcXvShmPutImage(ClientPtr client) swaps(&stuff->height, n); return ProcXvShmPutImage(client); } +#endif static int @@ -1864,6 +1880,7 @@ XineramaXvSetPortAttribute(ClientPtr client) } +#ifdef MITSHM static int XineramaXvShmPutImage(ClientPtr client) { @@ -1910,6 +1927,7 @@ XineramaXvShmPutImage(ClientPtr client) } return result; } +#endif static int XineramaXvPutImage(ClientPtr client) diff --git a/xc/programs/Xserver/Xprint/attributes.c b/xc/programs/Xserver/Xprint/attributes.c index 8b19192e0..3104d6af1 100644 --- a/xc/programs/Xserver/Xprint/attributes.c +++ b/xc/programs/Xserver/Xprint/attributes.c @@ -44,7 +44,7 @@ copyright holders. ** ********************************************************* ** ********************************************************************/ -/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.9 1999/12/27 00:39:32 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.10 2000/08/10 17:40:30 dawes Exp $ */ #include <Xproto.h> #include <string.h> @@ -1206,7 +1206,7 @@ ReplaceAllKeywords( #define toascii( c ) ((unsigned)(c) & 0x007f) #endif -#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL)) || defined(__EMX__) || defined(ISC) || defined(Lynx) || defined(__QNX__) +#if defined(CSRG_BASED) || defined(linux) || defined(__CYGWIN__) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL)) || defined(__EMX__) || defined(ISC) || defined(Lynx) || defined(__QNX__) #define iswspace(c) (isascii(c) && isspace(toascii(c))) #endif diff --git a/xc/programs/Xserver/afb/afb.h b/xc/programs/Xserver/afb/afb.h index ef96c3231..439c257f0 100644 --- a/xc/programs/Xserver/afb/afb.h +++ b/xc/programs/Xserver/afb/afb.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/afb/afb.h,v 3.5 1999/06/27 16:17:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/afb/afb.h,v 3.6 2000/07/15 00:27:07 mvojkovi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -63,7 +63,7 @@ extern int afbInverseAlu[]; extern int afbScreenPrivateIndex; /* warning: PixelType definition duplicated in maskbits.h */ #ifndef PixelType -#define PixelType unsigned long +#define PixelType CARD32 #endif /* PixelType */ #define AFB_MAX_DEPTH 8 diff --git a/xc/programs/Xserver/cfb/cfbmskbits.h b/xc/programs/Xserver/cfb/cfbmskbits.h index f309e4587..edf07b26b 100644 --- a/xc/programs/Xserver/cfb/cfbmskbits.h +++ b/xc/programs/Xserver/cfb/cfbmskbits.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.8 2000/02/12 03:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.9 2000/07/26 01:52:14 tsi Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -35,6 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "Xmd.h" #include "servermd.h" #if defined(XFREE86) || ( defined(__OpenBSD__) && defined(__alpha__) ) +#include "xf86_ansic.h" #define NO_COMPILER_H_EXTRAS #include "compiler.h" #endif diff --git a/xc/programs/Xserver/fb/fb24_32.c b/xc/programs/Xserver/fb/fb24_32.c index cfcf368ba..08073a49d 100644 --- a/xc/programs/Xserver/fb/fb24_32.c +++ b/xc/programs/Xserver/fb/fb24_32.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb24_32.c,v 1.3 2000/05/06 21:09:31 keithp Exp $ + * $XFree86: xc/programs/Xserver/fb/fb24_32.c,v 1.4 2000/08/09 17:50:51 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -555,7 +555,6 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) GXcopy, FB_ALLONES); - (*pScreen->DestroyPixmap) (pOldTile); return pNewTile; } diff --git a/xc/programs/Xserver/fb/fbgc.c b/xc/programs/Xserver/fb/fbgc.c index 83d94e5b0..75bae7a79 100644 --- a/xc/programs/Xserver/fb/fbgc.c +++ b/xc/programs/Xserver/fb/fbgc.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbgc.c,v 1.9 2000/05/06 21:09:32 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/fb/fbgc.c,v 1.10 2000/08/09 17:50:51 keithp Exp $ */ #include "fb.h" #ifdef IN_MODULE @@ -214,6 +214,12 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) changes |= GCStipple|GCForeground|GCBackground|GCPlaneMask; pPriv->bpp = pDrawable->bitsPerPixel; } + if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) + { + (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC)); + fbGetRotatedPixmap(pGC) = 0; + } + if (pGC->fillStyle == FillTiled) { PixmapPtr pOldTile, pNewTile; @@ -221,9 +227,16 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) pOldTile = pGC->tile.pixmap; if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) { - pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel); + pNewTile = fbGetRotatedPixmap(pGC); + if (!pNewTile || pNewTile ->drawable.bitsPerPixel != pDrawable->bitsPerPixel) + { + if (pNewTile) + (*pGC->pScreen->DestroyPixmap) (pNewTile); + pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel); + } if (pNewTile) { + fbGetRotatedPixmap(pGC) = pOldTile; pGC->tile.pixmap = pNewTile; changes |= GCTile; } diff --git a/xc/programs/Xserver/fb/fboverlay.c b/xc/programs/Xserver/fb/fboverlay.c index 548419fdc..0c0106e04 100644 --- a/xc/programs/Xserver/fb/fboverlay.c +++ b/xc/programs/Xserver/fb/fboverlay.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fboverlay.c,v 1.2 2000/05/11 18:14:13 tsi Exp $ + * $XFree86: xc/programs/Xserver/fb/fboverlay.c,v 1.3 2000/08/09 17:50:52 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -38,15 +38,31 @@ fbOverlayCreateWindow(WindowPtr pWin) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); int i; + PixmapPtr pPixmap; if (pWin->drawable.class != InputOutput) return TRUE; for (i = 0; i < pScrPriv->nlayers; i++) - if (pWin->drawable.depth == pScrPriv->pLayer[i]->drawable.depth) - { - pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pScrPriv->pLayer[i]; + { + pPixmap = pScrPriv->layer[i].u.run.pixmap; + if (pWin->drawable.depth == pPixmap->drawable.depth) + { + pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap; + /* + * Make sure layer keys are written correctly by + * having non-root layers set to full while the + * root layer is set to empty. This will cause + * all of the layers to get painted when the root + * is mapped + */ + if (!pWin->parent) + { + REGION_EMPTY (pWin->drawable.pScreen, + &pScrPriv->layer[i].u.run.region); + } return TRUE; - } + } + } return FALSE; } @@ -57,47 +73,206 @@ fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen) int i; for (i = 0; i < pScrPriv->nlayers; i++) - (*pScreen->DestroyPixmap)(pScrPriv->pLayer[i]); + { + (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap); + REGION_UNINIT (pScreen, &pScrPriv->layer[i].u.run.region); + } return TRUE; } +/* + * Return layer containing this window + */ +int +fbOverlayWindowLayer(WindowPtr pWin) +{ + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); + int i; + + for (i = 0; i < pScrPriv->nlayers; i++) + if (pWin->devPrivates[fbWinPrivateIndex].ptr == + (pointer) pScrPriv->layer[i].u.run.pixmap) + return i; + return 0; +} + Bool fbOverlayCreateScreenResources(ScreenPtr pScreen) { int i; - FbOverlayScrInitPtr pInit = (FbOverlayScrInitPtr) (pScreen)->devPrivates[fbOverlayScreenPrivateIndex].ptr; - FbOverlayScrPrivPtr pScrPriv; + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); PixmapPtr pPixmap; - FbOverlayInitPtr overlay; + pointer pbits; + int width; + int depth; + BoxRec box; if (!miCreateScreenResources(pScreen)) return FALSE; - - pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec)); - if (!pScrPriv) - return FALSE; - for (i = 0; i < pInit->nlayers; i++) + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + for (i = 0; i < pScrPriv->nlayers; i++) { - overlay = &pInit->init[i]; - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, overlay->depth); + pbits = pScrPriv->layer[i].u.init.pbits; + width = pScrPriv->layer[i].u.init.width; + depth = pScrPriv->layer[i].u.init.depth; + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, - pScreen->height, overlay->depth, - BitsPerPixel(overlay->depth), - PixmapBytePad(overlay->width, overlay->depth), - overlay->pbits)) + pScreen->height, depth, + BitsPerPixel(depth), + PixmapBytePad(width, depth), + pbits)) return FALSE; - pScrPriv->pLayer[i] = pPixmap; + pScrPriv->layer[i].u.run.pixmap = pPixmap; + REGION_INIT(pScreen, &pScrPriv->layer[i].u.run.region, &box, 0); } - pScrPriv->nlayers = pInit->nlayers; - xfree (pInit); - (pScreen)->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pScrPriv; - pScreen->devPrivate = pScrPriv->pLayer[0]; + pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap; return TRUE; } +void +fbOverlayPaintKey (DrawablePtr pDrawable, + RegionPtr pRegion, + CARD32 pixel, + int layer) +{ + fbFillRegionSolid (pDrawable, pRegion, 0, + fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); +} + +/* + * Track visible region for each layer + */ +void +fbOverlayUpdateLayerRegion (ScreenPtr pScreen, + int layer, + RegionPtr prgn) +{ + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + int i; + RegionRec rgnNew; + + if (!prgn || !REGION_NOTEMPTY(pScreen, prgn)) + return; + for (i = 0; i < pScrPriv->nlayers; i++) + { + if (i == layer) + { + /* add new piece to this fb */ + REGION_UNION (pScreen, + &pScrPriv->layer[i].u.run.region, + &pScrPriv->layer[i].u.run.region, + prgn); + } + else if (REGION_NOTEMPTY (pScreen, + &pScrPriv->layer[i].u.run.region)) + { + /* paint new piece with chroma key */ + REGION_INIT (pScreen, &rgnNew, NullBox, 0); + REGION_INTERSECT (pScreen, + &rgnNew, + prgn, + &pScrPriv->layer[i].u.run.region); + (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable, + &rgnNew, + pScrPriv->layer[i].key, + i); + REGION_UNINIT(pScreen, &rgnNew); + /* remove piece from other fbs */ + REGION_SUBTRACT (pScreen, + &pScrPriv->layer[i].u.run.region, + &pScrPriv->layer[i].u.run.region, + prgn); + } + } +} + +/* + * Copy only areas in each layer containing real bits + */ +void +fbOverlayCopyWindow(WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; + int i; + RegionRec layerRgn[FB_OVERLAY_MAX]; + PixmapPtr pPixmap; + + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + + /* + * Clip to existing bits + */ + REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); + REGION_INIT (pScreen, &rgnDst, NullBox, 0); + REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + REGION_TRANSLATE(pScreen, &rgnDst, dx, dy); + /* + * Compute the portion of each fb affected by this copy + */ + for (i = 0; i < pScrPriv->nlayers; i++) + { + REGION_INIT (pScreen, &layerRgn[i], NullBox, 0); + REGION_INTERSECT(pScreen, &layerRgn[i], &rgnDst, + &pScrPriv->layer[i].u.run.region); + if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + { + REGION_TRANSLATE(pScreen, &layerRgn[i], -dx, -dy); + pPixmap = pScrPriv->layer[i].u.run.pixmap; + fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, + 0, + &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0, + (void *) i); + } + } + /* + * Update regions + */ + for (i = 0; i < pScrPriv->nlayers; i++) + { + if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]); + + REGION_UNINIT(pScreen, &layerRgn[i]); + } + REGION_UNINIT(pScreen, &rgnDst); +} + +void +fbOverlayWindowExposures (WindowPtr pWin, + RegionPtr prgn, + RegionPtr other_exposed) +{ + fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, + fbOverlayWindowLayer (pWin), + prgn); + miWindowExposures(pWin, prgn, other_exposed); +} + +void +fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + if (what == PW_BORDER) + fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, + fbOverlayWindowLayer (pWin), + pRegion); + fbPaintWindow (pWin, pRegion, what); +} + Bool fbOverlaySetupScreen(ScreenPtr pScreen, pointer pbits1, @@ -141,19 +316,18 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, int nvisuals; int ndepths; VisualID defaultVisual; - FbOverlayScrInitPtr pInit; - + FbOverlayScrPrivPtr pScrPriv; + if (fbOverlayGeneration != serverGeneration) { fbOverlayScreenPrivateIndex = AllocateScreenPrivateIndex (); fbOverlayGeneration = serverGeneration; } - - pInit = xalloc (sizeof (FbOverlayScrInitRec)); - if (!pInit) + + pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec)); + if (!pScrPriv) return FALSE; - if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1, &defaultVisual, ((unsigned long)1<<(bpp1-1)) | ((unsigned long)1<<(bpp2-1)), 8)) @@ -173,20 +347,25 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 2; - pInit->nlayers = 2; - pInit->init[0].pbits = pbits1; - pInit->init[0].width = width1; - pInit->init[0].depth = depth1; + pScrPriv->nlayers = 2; + pScrPriv->PaintKey = fbOverlayPaintKey; + pScrPriv->CopyWindow = fbCopyWindowProc; + pScrPriv->layer[0].u.init.pbits = pbits1; + pScrPriv->layer[0].u.init.width = width1; + pScrPriv->layer[0].u.init.depth = depth1; - pInit->init[1].pbits = pbits2; - pInit->init[1].width = width2; - pInit->init[1].depth = depth2; - - pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pInit; + pScrPriv->layer[1].u.init.pbits = pbits2; + pScrPriv->layer[1].u.init.width = width2; + pScrPriv->layer[1].u.init.depth = depth2; + + pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pScrPriv; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbOverlayCloseScreen; pScreen->CreateScreenResources = fbOverlayCreateScreenResources; pScreen->CreateWindow = fbOverlayCreateWindow; + pScreen->WindowExposures = fbOverlayWindowExposures; + pScreen->CopyWindow = fbOverlayCopyWindow; + pScreen->PaintWindowBorder = fbOverlayPaintWindow; return TRUE; } diff --git a/xc/programs/Xserver/fb/fboverlay.h b/xc/programs/Xserver/fb/fboverlay.h index d45f16e8a..f7e544426 100644 --- a/xc/programs/Xserver/fb/fboverlay.h +++ b/xc/programs/Xserver/fb/fboverlay.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fboverlay.h,v 1.2 2000/05/11 18:14:13 tsi Exp $ + * $XFree86: xc/programs/Xserver/fb/fboverlay.h,v 1.3 2000/08/09 17:50:52 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -29,36 +29,73 @@ extern int fbOverlayGeneration; extern int fbOverlayScreenPrivateIndex; -#define FB_OVERLAY_MAX 3 +#ifndef FB_OVERLAY_MAX +#define FB_OVERLAY_MAX 2 +#endif + +typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int); + +typedef struct _fbOverlayLayer { + union { + struct { + pointer pbits; + int width; + int depth; + } init; + struct { + PixmapPtr pixmap; + RegionRec region; + } run; + } u; + CARD32 key; /* special pixel value */ +} FbOverlayLayer; typedef struct _fbOverlayScrPriv { - int nlayers; - PixmapPtr pLayer[FB_OVERLAY_MAX]; + int nlayers; + fbOverlayPaintKeyProc PaintKey; + fbCopyProc CopyWindow; + FbOverlayLayer layer[FB_OVERLAY_MAX]; } FbOverlayScrPrivRec, *FbOverlayScrPrivPtr; #define fbOverlayGetScrPriv(s) ((FbOverlayScrPrivPtr) \ (s)->devPrivates[fbOverlayScreenPrivateIndex].ptr) -typedef struct _fbOverlayInit { - pointer pbits; - int width; - int depth; -} FbOverlayInitRec, *FbOverlayInitPtr; - -typedef struct _fbOverlayScrInit { - int nlayers; - FbOverlayInitRec init[FB_OVERLAY_MAX]; -} FbOverlayScrInitRec, *FbOverlayScrInitPtr; - Bool fbOverlayCreateWindow(WindowPtr pWin); Bool fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen); +int +fbOverlayWindowLayer(WindowPtr pWin); + Bool fbOverlayCreateScreenResources(ScreenPtr pScreen); +void +fbOverlayPaintKey (DrawablePtr pDrawable, + RegionPtr pRegion, + CARD32 pixel, + int layer); +void +fbOverlayUpdateLayerRegion (ScreenPtr pScreen, + int layer, + RegionPtr prgn); + + +void +fbOverlayCopyWindow(WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +void +fbOverlayWindowExposures (WindowPtr pWin, + RegionPtr prgn, + RegionPtr other_exposed); + +void +fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); + Bool fbOverlaySetupScreen(ScreenPtr pScreen, diff --git a/xc/programs/Xserver/fb/fbwindow.c b/xc/programs/Xserver/fb/fbwindow.c index 9f5bb0980..e4c482bc8 100644 --- a/xc/programs/Xserver/fb/fbwindow.c +++ b/xc/programs/Xserver/fb/fbwindow.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbwindow.c,v 1.6 2000/05/06 21:09:34 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/fb/fbwindow.c,v 1.7 2000/08/09 17:50:52 keithp Exp $ */ #include "fb.h" #ifdef IN_MODULE @@ -157,7 +157,10 @@ fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) pPixmap = fb24_32ReformatTile (pPixmap, pWin->drawable.bitsPerPixel); if (pPixmap) + { + (*pWin->drawable.pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->background.pixmap = pPixmap; + } } #endif if (FbEvenTile (pPixmap->drawable.width * @@ -177,7 +180,10 @@ fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) pPixmap = fb24_32ReformatTile (pPixmap, pWin->drawable.bitsPerPixel); if (pPixmap) + { + (*pWin->drawable.pScreen->DestroyPixmap) (pWin->border.pixmap); pWin->border.pixmap = pPixmap; + } } #endif if (FbEvenTile (pPixmap->drawable.width * diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3.c b/xc/programs/Xserver/hw/kdrive/savage/s3.c index 99a34bb08..52cdfbd1c 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3.c +++ b/xc/programs/Xserver/hw/kdrive/savage/s3.c @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.c,v 1.4 2000/05/06 22:17:44 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.c,v 1.5 2000/08/09 17:52:41 keithp Exp $ */ #include "s3.h" @@ -226,11 +226,12 @@ s3ModeUsable (KdScreenInfo *screen) screen->fb[fb].bitsPerPixel = 8; } - byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[fb].pixelStride = pixel_width; - screen->fb[fb].byteStride = byte_width; - screen_size += byte_width * screen->height; + /* + * SGRAM requires stride % 64 == 0 + */ + screen->fb[fb].pixelStride = (screen->width + 63) & ~63; + screen->fb[fb].byteStride = screen->fb[fb].pixelStride * (screen->fb[fb].bitsPerPixel >> 3); + screen_size += screen->fb[fb].byteStride * screen->height; } return screen_size <= s3c->memory; @@ -340,6 +341,12 @@ s3ScreenInit (KdScreenInfo *screen) screen->fb[fb].frameBuffer = s3c->frameBuffer + screen_size; screen_size += screen->fb[fb].byteStride * screen->height; + REGION_INIT(pScreen, (&s3s->region[fb]), NullBox, 0); + if (screen->fb[fb].bitsPerPixel == 8) + s3s->fb[ma].chroma_key = 0xff; + else + s3s->fb[ma].chroma_key = 0; + /* * Use remaining memory for off-screen storage, but only use * one piece (either right or bottom). @@ -1101,6 +1108,9 @@ s3Enable (ScreenPtr pScreen) s3Set (s3vga, s3_sequential_addressing_mode, 1); s3Set (s3vga, s3_select_chain_4_mode, 1); s3Set (s3vga, s3_linear_addressing_control, 1); + + s3Set (s3vga, s3_enable_gamma_correction, 0); + s3Set (s3vga, s3_enable_8_bit_luts, 1); s3Set (s3vga, s3_dclk_invert, 0); @@ -1150,7 +1160,6 @@ s3Enable (ScreenPtr pScreen) s3Set (s3vga, s3_eclk_r, r); #endif - s3s->manage_border = FALSE; /* * Compute character lengths for horizontal timing values */ @@ -1189,10 +1198,6 @@ s3Enable (ScreenPtr pScreen) h_blank_start_adjust = -3; h_blank_end_adjust = -4; s3Set (s3vga, s3_border_select, 0); -#if 0 - s3s->manage_border = TRUE; - /* s3Set (s3vga, s3_border_color, pScreen->blackPixel); */ -#endif } break; case 16: @@ -1522,6 +1527,8 @@ s3Enable (ScreenPtr pScreen) VgaFlush(&s3vga->card); VgaSetImm (&s3vga->card, s3_clock_load_imm, 1); VgaSetImm(&s3vga->card, s3_clock_load_imm, 0); + + if (s3s->use_streams) { fb = s3s->fbmap[0]; @@ -1537,7 +1544,7 @@ s3Enable (ScreenPtr pScreen) fb = s3s->fbmap[1]; s3->blend_control = 5 << 24; if (s3s->fb[0].accel_bpp == 8) - s3->chroma_key_control = 0x330000ff; + s3->chroma_key_control = 0x33000000 | s3s->fb[0].chroma_key; else s3->chroma_key_control = 0x13010101; s3->secondary_stream_control = control[1] | screen->width; @@ -1758,97 +1765,26 @@ s3DPMS (ScreenPtr pScreen, int mode) return TRUE; } -void -s3DumbPaintChromaKey (WindowPtr pWin, RegionPtr pRegion) +Bool +s3InitScreen(ScreenPtr pScreen) { - ScreenPtr pScreen = pWin->drawable.pScreen; KdScreenPriv(pScreen); KdCardInfo *card = pScreenPriv->card; KdScreenInfo *screen = pScreenPriv->screen; s3CardInfo (pScreenPriv); s3ScreenInfo (pScreenPriv); - - if (pWin->drawable.depth != s3s->primary_depth) + int ma, fb; + + if (screen->fb[1].depth) { - int nBox = REGION_NUM_RECTS(pRegion); - BoxPtr pBox = REGION_RECTS(pRegion); - PixmapPtr pPixmap; - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - FbBits *dst; - FbStride dstStride; - int dstBpp; - - if (pScrPriv->pLayer[0]->drawable.depth == pWin->drawable.depth) - pPixmap = pScrPriv->pLayer[1]; - else - pPixmap = pScrPriv->pLayer[0]; - fbGetDrawable (&pPixmap->drawable, dst, dstStride, dstBpp); - while (nBox--) + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) { - fbSolid (dst + pBox->y1 * dstStride, - dstStride, - pBox->x1 * dstBpp, - dstBpp, - (pBox->x2 - pBox->x1) * dstBpp, - (pBox->y2 - pBox->y1), - 0x0, FB_ALLONES); - pBox++; + fb = s3s->fbmap[ma]; + pScrPriv->layer[fb].key = s3s->fb[ma].chroma_key; } } -} - -void -s3DumbPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) -{ - s3DumbPaintChromaKey (pWin, pRegion); - fbPaintWindow (pWin, pRegion, what); -} - -void -s3DumbCopyWindow (WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RegionRec rgnDst; - int dx, dy; - PixmapPtr pPixmap; - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - int fb; - - KdCheckSync (pScreen); - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - - REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); - - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - for (fb = 0; fb < pScrPriv->nlayers; fb++) - { - pPixmap = pScrPriv->pLayer[fb]; - fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, - 0, - &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - } - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); - fbValidateDrawable (&pWin->drawable); -} - -Bool -s3InitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - s3CardInfo (pScreenPriv); - s3ScreenInfo (pScreenPriv); - - pScreen->PaintWindowBackground = s3DumbPaintWindow; - pScreen->PaintWindowBorder = s3DumbPaintWindow; - pScreen->CopyWindow = s3DumbCopyWindow; return TRUE; } diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3.h b/xc/programs/Xserver/hw/kdrive/savage/s3.h index 602411598..f0520873e 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3.h +++ b/xc/programs/Xserver/hw/kdrive/savage/s3.h @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.4 2000/05/06 22:17:45 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.5 2000/08/09 17:52:41 keithp Exp $ */ #ifndef _S3_H_ #define _S3_H_ @@ -439,18 +439,19 @@ typedef struct _s3FbInfo { CARD32 bitmap_offset; int accel_stride; int accel_bpp; + CARD32 chroma_key; } S3FBInfo; typedef struct _s3ScreenInfo { CARD8 *cursor_base; /* pointer to cursor area */ S3Cursor cursor; - Bool manage_border; Bool managing_border; Bool use_streams; int primary_depth; int current_ma; CARD32 border_pixel; S3FBInfo fb[KD_MAX_FB]; + RegionRec region[KD_MAX_FB]; int fbmap[KD_MAX_FB+1]; /* map from fb to stream */ } S3ScreenInfo; diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3cmap.c b/xc/programs/Xserver/hw/kdrive/savage/s3cmap.c index d861be66d..39022ff77 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3cmap.c +++ b/xc/programs/Xserver/hw/kdrive/savage/s3cmap.c @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.4 2000/05/06 22:17:45 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.5 2000/08/09 17:52:41 keithp Exp $ */ #include "s3.h" @@ -43,15 +43,51 @@ s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) } } +#ifndef S3_TRIO +#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d))) + +void +s3SetTrueChromaKey (ScreenPtr pScreen, int pfb, xColorItem *pdef) +{ + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + KdScreenPriv(pScreen); + s3ScreenInfo(pScreenPriv); + int fb, ma; + CARD32 key; + int r, g, b; + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + { + fb = s3s->fbmap[ma]; + if (fb != pfb && pScreenPriv->screen->fb[fb].redMask) + { + r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask); + g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask); + b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask); + key = ((Shift(pdef->red,r) & pScreenPriv->screen->fb[fb].redMask) | + (Shift(pdef->green,g) & pScreenPriv->screen->fb[fb].greenMask) | + (Shift(pdef->blue,b) & pScreenPriv->screen->fb[fb].blueMask)); + if (pScrPriv->layer[fb].key != key) + { + pScrPriv->layer[fb].key = key; + (*pScrPriv->PaintKey) (&pScrPriv->layer[fb].u.run.pixmap->drawable, + &pScrPriv->layer[pfb].u.run.region, + pScrPriv->layer[fb].key, fb); + } + } + } +} +#endif + void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) { KdScreenPriv(pScreen); s3CardInfo(pScreenPriv); s3ScreenInfo(pScreenPriv); - S3Vga *s3vga = &s3c->s3vga; - Bool hit_border = FALSE; - Bool check_border = FALSE; + S3Vga *s3vga = &s3c->s3vga; + xColorItem *chroma = 0; + CARD32 key; #if 0 _s3WaitVRetrace (s3vga); @@ -59,34 +95,28 @@ s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) S3Ptr s3 = s3c->s3; _s3WaitVRetraceFast(s3); #endif - if (pScreenPriv->enabled && s3s->manage_border && !s3s->managing_border) - check_border = TRUE; +#ifndef S3_TRIO + if (pScreenPriv->screen->fb[1].depth) + { + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + key = pScrPriv->layer[fb].key; + } +#endif + else + key = ~0; while (ndef--) { - if (check_border && pdefs->pixel == s3s->border_pixel) - { - if (pdefs->red || pdefs->green || pdefs->blue) - hit_border = TRUE; - } + if (pdefs->pixel == key) + chroma = pdefs; s3SetImm (s3vga, s3_dac_write_index, pdefs->pixel); s3SetImm (s3vga, s3_dac_data, pdefs->red >> 8); s3SetImm (s3vga, s3_dac_data, pdefs->green >> 8); s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8); pdefs++; } - if (hit_border) - { - xColorItem black; - - black.red = 0; - black.green = 0; - black.blue = 0; - s3s->managing_border = TRUE; - FakeAllocColor (pScreenPriv->pInstalledmap[fb], - &black); - s3s->border_pixel = black.pixel; - FakeFreeColor (pScreenPriv->pInstalledmap[fb], s3s->border_pixel); -/* s3SetImm (&s3c->s3vga, s3_border_color, (VGA8) s3s->border_pixel); */ - } +#ifndef S3_TRIO + if (chroma && !pScreenPriv->closed) + s3SetTrueChromaKey (pScreen, fb, chroma); +#endif } diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3draw.c b/xc/programs/Xserver/hw/kdrive/savage/s3draw.c index f90ca3355..e4205ba40 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3draw.c +++ b/xc/programs/Xserver/hw/kdrive/savage/s3draw.c @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.4 2000/05/06 22:17:46 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.5 2000/08/09 17:52:41 keithp Exp $ */ #include "s3.h" #include "s3draw.h" @@ -491,7 +491,6 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, BoxPtr pboxClippedBase; BoxPtr pextent; BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); int numRects; int n; int xorg, yorg; @@ -712,7 +711,6 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, int nTmp; int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); BoxPtr extents; S3PatternCache *cache; RegionPtr pClip = fbGetCompositeClip (pGC); @@ -994,17 +992,19 @@ s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs) } void -s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int countInit, DDXPointPtr ptsIn) +s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, + int mode, int countInit, DDXPointPtr ptsIn) { SetupS3(pDrawable->pScreen); - FbGCPrivPtr fbPriv; int nwidth; int maxy; + int origin; int count; register int vertex1, vertex2; int c; + RegionPtr pClip = fbGetCompositeClip(pGC); BoxPtr extents; + int clip; int y, sy; int *vertex1p, *vertex2p; int *endp; @@ -1018,17 +1018,21 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, int l, r; int nmiddle; - if (mode == CoordModePrevious) + if (mode == CoordModePrevious || REGION_NUM_RECTS(pClip) != 1) { KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); return; } s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - fbPriv = fbGetGCPrivate(pGC); sy = pDrawable->y; sx = pDrawable->x; - extents = &fbGetCompositeClip(pGC)->extents; + origin = *((int *) &pDrawable->x); + origin -= (origin & 0x8000) << 1; + extents = &pClip->extents; + vertex1 = *((int *) &extents->x1) - origin; + vertex2 = *((int *) &extents->x2) - origin - 0x00010001; + clip = 0; y = 32767; maxy = 0; @@ -1040,14 +1044,7 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, while (count--) { c = *vertex2p; - /* - * Check for negative or over S3 limits - */ - if (c & 0xe000e000) - { - KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); - return; - } + clip |= (c - vertex1) | (vertex2 - c); c = intToY(c); DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); if (c < y) @@ -1070,14 +1067,7 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, while (count--) { c = *vertex2p; - /* - * Check for negative or over S3 limits - */ - if (c & 0xe000e000) - { - KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); - return; - } + clip |= (c - vertex1) | (vertex2 - c); c = intToY(c); DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); if (c < y) @@ -1111,16 +1101,17 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, if (x1 != dx2) yFlip++; if (yFlip != 2) - { - KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); - return; - } + clip = 0x8000; } if (y == maxy) return; + if (clip & 0x80008000) + { + KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); + return; + } _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - _s3SetClip(s3,extents); vertex2p = vertex1p; vertex2 = vertex1 = *vertex2p++; @@ -1236,7 +1227,6 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, if (y == maxy) break; } - _s3ResetClip (s3, pDrawable->pScreen); MarkSyncS3 (pDrawable->pScreen); } @@ -2162,15 +2152,8 @@ s3CreateWindow (WindowPtr pWin) KdScreenPriv(pWin->drawable.pScreen); s3ScreenInfo(pScreenPriv); - if (!KdCreateWindow (pWin)) - return FALSE; pWin->devPrivates[s3WindowPrivateIndex].ptr = 0; -#ifndef S3_TRIO - if (pWin->drawable.depth != s3s->primary_depth) - return fbOverlayCreateWindow (pWin); - else -#endif - return fbCreateWindow (pWin); + return KdCreateWindow (pWin); } Bool @@ -2217,27 +2200,34 @@ s3ChangeWindowAttributes (WindowPtr pWin, Mask mask) return ret; } + #ifndef S3_TRIO void -s3PaintChromaKey (WindowPtr pWin, RegionPtr pRegion) +s3PaintKey (DrawablePtr pDrawable, + RegionPtr pRegion, + CARD32 pixel, + int fb) { - SetupS3 (pWin->drawable.pScreen); + SetupS3 (pDrawable->pScreen); s3ScreenInfo (pScreenPriv); + int nBox = REGION_NUM_RECTS(pRegion); + BoxPtr pBox = REGION_RECTS(pRegion); + int ma; - if (pWin->drawable.depth != s3s->primary_depth) + if (!nBox) + return; + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + if (s3s->fbmap[ma] == fb) + break; + s3SetGlobalBitmap (pDrawable->pScreen, ma); + _s3SetSolidFill (s3, pixel, GXcopy, 0xffffffff); + while (nBox--) { - int nBox = REGION_NUM_RECTS(pRegion); - BoxPtr pBox = REGION_RECTS(pRegion); - - s3SetGlobalBitmap (pWin->drawable.pScreen, 0); - _s3SetSolidFill(s3,0xffffffff,GXcopy,0xffffffff); - while (nBox--) - { - _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); - pBox++; - } - MarkSyncS3 (pWin->drawable.pScreen); + _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); + pBox++; } + MarkSyncS3 (pDrawable->pScreen); } #endif @@ -2245,6 +2235,7 @@ void s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { SetupS3(pWin->drawable.pScreen); + s3ScreenInfo(pScreenPriv); s3PatternPtr pPattern; DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d", @@ -2254,9 +2245,6 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) REGION_NUM_RECTS(pRegion))); if (!REGION_NUM_RECTS(pRegion)) return; -#ifndef S3_TRIO - s3PaintChromaKey (pWin, pRegion); -#endif switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { @@ -2289,6 +2277,12 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) } break; case PW_BORDER: +#ifndef S3_TRIO + if (s3s->fbmap[1] >= 0) + fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, + fbOverlayWindowLayer (pWin), + pRegion); +#endif if (pWin->borderIsPixel) { s3FillBoxSolid((DrawablePtr)pWin, @@ -2303,19 +2297,6 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) } void -s3RestoreAreas(PixmapPtr pPixmap, - RegionPtr prgnRestore, - int xorg, - int yorg, - WindowPtr pWin) -{ -#ifndef S3_TRIO - s3PaintChromaKey (pWin, prgnRestore); -#endif - KdCheckRestoreAreas (pPixmap, prgnRestore, xorg, yorg, pWin); -} - -void s3CopyWindowProc (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, @@ -2330,86 +2311,94 @@ s3CopyWindowProc (DrawablePtr pSrcDrawable, { SetupS3(pDstDrawable->pScreen); s3ScreenInfo(pScreenPriv); - int srcX, srcY, dstX, dstY; - int x1, x2; - int w, h; - int flags; - int ma; - BoxPtr pbox; - int nbox; + KdScreenInfo *screen = pScreenPriv->screen; + int srcX, srcY, dstX, dstY; + int x1, x2; + int w, h; + int flags; + int fb = (int) closure; + int ma; + BoxPtr pbox; + int nbox; + int bitsPerPixel; - if (pSrcDrawable->bitsPerPixel == 24) - dx *= 3; #ifdef S3_TRIO ma = 0; #else for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + if (s3s->fbmap[ma] == fb) + break; #endif + bitsPerPixel = screen->fb[fb].bitsPerPixel; + if (bitsPerPixel == 24) + dx *= 3; + nbox = nboxOrig; + pbox = pboxOrig; + s3SetGlobalBitmap (pDstDrawable->pScreen, ma); + _s3SetBlt(s3,GXcopy,~0); + while (nbox--) { - nbox = nboxOrig; - pbox = pboxOrig; - s3SetGlobalBitmap (pDstDrawable->pScreen, ma); - _s3SetBlt(s3,GXcopy,~0); - while (nbox--) + x1 = pbox->x1; + x2 = pbox->x2; + if (bitsPerPixel == 24) { - x1 = pbox->x1; - x2 = pbox->x2; - if (pSrcDrawable->bitsPerPixel == 24) - { - x1 *= 3; - x2 *= 3; - } - - w = x2 - x1; - h = pbox->y2 - pbox->y1; - flags = 0; - if (reverse) - { - dstX = x2 - 1; - } - else - { - dstX = x1; - flags |= INC_X; - } - srcX = dstX + dx; - - if (upsidedown) - { - dstY = pbox->y2 - 1; - } - else - { - dstY = pbox->y1; - flags |= INC_Y; - } - srcY = dstY + dy; - - _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); - pbox++; + x1 *= 3; + x2 *= 3; + } + + w = x2 - x1; + h = pbox->y2 - pbox->y1; + flags = 0; + if (reverse) + { + dstX = x2 - 1; + } + else + { + dstX = x1; + flags |= INC_X; + } + srcX = dstX + dx; + + if (upsidedown) + { + dstY = pbox->y2 - 1; + } + else + { + dstY = pbox->y1; + flags |= INC_Y; } - MarkSyncS3 (pDstDrawable->pScreen); + srcY = dstY + dy; + + _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); + pbox++; } + MarkSyncS3 (pDstDrawable->pScreen); } void s3CopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - ScreenPtr pScreen = pWin->drawable.pScreen; - KdScreenPriv(pScreen); - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; + ScreenPtr pScreen = pWin->drawable.pScreen; + KdScreenPriv (pScreen); + s3ScreenInfo (pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); - - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, + &pWin->borderClip, prgnSrc); fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, 0, @@ -2451,7 +2440,6 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, int nTmp; int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); BoxPtr extents; RegionPtr pClip = fbGetCompositeClip (pGC); @@ -2625,7 +2613,6 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, BoxPtr pboxClippedBase; BoxPtr pextent; BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); int numRects; int n; int xorg, yorg; @@ -3096,13 +3083,18 @@ s3DrawInit (ScreenPtr pScreen) pScreen->DestroyWindow = s3DestroyWindow; pScreen->PaintWindowBackground = s3PaintWindow; pScreen->PaintWindowBorder = s3PaintWindow; - pScreen->CopyWindow = s3CopyWindow; - pScreen->BackingStoreFuncs.RestoreAreas = s3RestoreAreas; -#if 0 - pScreen->PaintWindowBackground = s3DumbPaintWindow; - pScreen->PaintWindowBorder = s3DumbPaintWindow; - pScreen->CopyWindow = s3DumbCopyWindow; +#ifndef S3_TRIO + if (pScreenPriv->screen->fb[1].depth) + { + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + + pScrPriv->PaintKey = s3PaintKey; + pScrPriv->CopyWindow = s3CopyWindowProc; + pScreen->CopyWindow = fbOverlayCopyWindow; + } + else #endif + pScreen->CopyWindow = s3CopyWindow; /* * Initialize patterns diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3draw.h b/xc/programs/Xserver/hw/kdrive/savage/s3draw.h index 73260e259..675c1b123 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3draw.h +++ b/xc/programs/Xserver/hw/kdrive/savage/s3draw.h @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.4 2000/05/06 22:17:47 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.5 2000/08/09 17:52:42 keithp Exp $ */ #ifndef _S3DRAW_H_ #define _S3DRAW_H_ @@ -413,8 +413,8 @@ void s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs); void -s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); +s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, + int mode, int count, DDXPointPtr ptsIn); void s3PolyGlyphBlt (DrawablePtr pDrawable, diff --git a/xc/programs/Xserver/hw/kdrive/savage/s3gc.c b/xc/programs/Xserver/hw/kdrive/savage/s3gc.c index 6141585d7..46dfdaf75 100644 --- a/xc/programs/Xserver/hw/kdrive/savage/s3gc.c +++ b/xc/programs/Xserver/hw/kdrive/savage/s3gc.c @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3gc.c,v 1.4 2000/02/23 20:30:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3gc.c,v 1.5 2000/08/09 17:52:42 keithp Exp $ */ #include "s3.h" #include "s3draw.h" @@ -47,63 +47,7 @@ * font <= 32 pixels wide */ -/* TE font, >= 4 pixels wide, one clip rectangle */ -static const GCOps s3TEOps1Rect = { - s3FillSpans, - KdCheckSetSpans, - KdCheckPutImage, - s3CopyArea, - s3CopyPlane, - KdCheckPolyPoint, - s3Polylines, - s3PolySegment, - KdCheckPolyRectangle, - KdCheckPolyArc, - s3FillPoly1Rect, - s3PolyFillRect, - s3PolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - s3ImageTEGlyphBlt, - s3PolyTEGlyphBlt, - s3PushPixels, -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -extern GCOps fbGCOps; - -/* Non TE font, one clip rectangle */ -static const GCOps s3NonTEOps1Rect = { - s3FillSpans, - KdCheckSetSpans, - KdCheckPutImage, - s3CopyArea, - s3CopyPlane, - KdCheckPolyPoint, - s3Polylines, - s3PolySegment, - KdCheckPolyRectangle, - KdCheckPolyArc, - s3FillPoly1Rect, - s3PolyFillRect, - s3PolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - s3ImageGlyphBlt, - s3PolyGlyphBlt, - s3PushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -/* TE font, != 1 clip rect (including 0) */ +/* TE font */ static const GCOps s3TEOps = { s3FillSpans, KdCheckSetSpans, @@ -115,7 +59,7 @@ static const GCOps s3TEOps = { s3PolySegment, KdCheckPolyRectangle, KdCheckPolyArc, - KdCheckFillPolygon, + s3FillPoly, s3PolyFillRect, s3PolyFillArcSolid, miPolyText8, @@ -130,7 +74,7 @@ static const GCOps s3TEOps = { #endif }; -/* Non TE font, != 1 clip rect (including 0) */ +/* Non TE font */ static const GCOps s3NonTEOps = { s3FillSpans, KdCheckSetSpans, @@ -142,7 +86,7 @@ static const GCOps s3NonTEOps = { s3PolySegment, KdCheckPolyRectangle, KdCheckPolyArc, - KdCheckFillPolygon, + s3FillPoly, s3PolyFillRect, s3PolyFillArcSolid, miPolyText8, @@ -182,19 +126,9 @@ s3MatchCommon (DrawablePtr pDraw, GCPtr pGC, FbGCPrivPtr fbPriv) if (pGC->font) { if (TERMINALFONT(pGC->font)) - { - if (fbPriv->oneRect) - return (GCOps *) &s3TEOps1Rect; - else - return (GCOps *) &s3TEOps; - } + return (GCOps *) &s3TEOps; else - { - if (fbPriv->oneRect) - return (GCOps *) &s3NonTEOps1Rect; - else - return (GCOps *) &s3NonTEOps; - } + return (GCOps *) &s3NonTEOps; } return 0; } @@ -203,19 +137,18 @@ void s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) { int new_type; /* drawable type has changed */ - int new_onerect; /* onerect value has changed */ int new_origin; /* flags for changing the proc vector */ FbGCPrivPtr fbPriv; s3PrivGCPtr s3Priv; int oneRect; + GCOps *newops; fbPriv = fbGetGCPrivate(pGC); s3Priv = s3GetGCPrivate(pGC); new_type = FALSE; - new_onerect = FALSE; new_origin = FALSE; /* @@ -236,13 +169,9 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) /* * Call down to FB to set clip list and rrop values */ - oneRect = fbPriv->oneRect; fbValidateGC (pGC, changes, pDrawable); - if (oneRect != fbPriv->oneRect) - new_onerect = TRUE; - /* * Check accelerated pattern if necessary */ @@ -256,19 +185,12 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) * Try to match common vector */ - if (new_type || new_onerect || - (changes & (GCLineWidth|GCLineStyle|GCFillStyle| - GCFont|GCForeground|GCFunction|GCPlaneMask))) + if (newops = s3MatchCommon (pDrawable, pGC, fbPriv)) { - GCOps *newops; - - if (newops = s3MatchCommon (pDrawable, pGC, fbPriv)) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - return; - } + if (pGC->ops->devPrivate.val) + miDestroyGCOps (pGC->ops); + pGC->ops = newops; + return; } /* @@ -335,14 +257,13 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) /* * Polygons */ - if (new_type || new_onerect || (changes & (GCFillStyle))) + if (new_type || (changes & (GCFillStyle))) { pGC->ops->FillPolygon = KdCheckFillPolygon; if (s3Priv->type == DRAWABLE_WINDOW && - fbPriv->oneRect && pGC->fillStyle == FillSolid) { - pGC->ops->FillPolygon = s3FillPoly1Rect; + pGC->ops->FillPolygon = s3FillPoly; } } diff --git a/xc/programs/Xserver/hw/kdrive/sis530/sis.c b/xc/programs/Xserver/hw/kdrive/sis530/sis.c index 1961f8040..e936efea0 100644 --- a/xc/programs/Xserver/hw/kdrive/sis530/sis.c +++ b/xc/programs/Xserver/hw/kdrive/sis530/sis.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.c,v 1.4 2000/05/06 22:17:49 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.c,v 1.5 2000/08/09 17:52:43 keithp Exp $ */ #include "sis.h" @@ -29,130 +29,10 @@ #define MMIO_SIZE (64 * 1024) -#define SIS_TIMING_BAIL 2 - -SisTiming sisTimings[] = { - /* FP BP BLANK */ - { 640, 480, 85, - 56, 80, 192, /* horizontal 43.265 KHz */ - 1, 25, 29, /* vertical 85.000 Hz */ - /* pixel 35.996 MHz */ - }, - - { 640, 480, 75, - 16, 120, 200, /* horizontal 37.500 KHz */ - 1, 16, 20, /* vertical 75.000 Hz */ - /* pixel 31.500 MHz */ - }, - - { 640, 480, 60, - 16, 48, 160, /* horizontal 31.321 KHz */ - 10, 33, 45, /* vertical 59.568 Hz */ - /* pixel 25.057 MHz */ - }, - - { 800, 600, 85, - 32, 152, 248, /* horizontal 53.673 KHz */ - 1, 27, 31, /* vertical 85.060 Hz */ - /* pixel 56.249 MHz */ - }, - { 800, 600, 75, - 16, 160, 256, /* horizontal 46.891 KHz */ - 1, 21, 25, /* vertical 75.025 Hz */ - /* pixel 49.516 MHz */ - }, - { 800, 600, 72, - 56, 64, 240, /* horizontal 48.186 KHz */ - 37, 23, 66, /* vertical 72.351 Hz */ - /* pixel 50.113 MHz */ - }, - - { 1024, 768, 85, - 48, 208, 352, /* horizontal 68.676 KHz */ - 1, 36, 40, /* vertical 84.996 Hz */ - /* pixel 94.499 MHz */ - }, - { 1024, 768, 75, - 16, 176, 288, /* horizontal 60.022 KHz */ - 1, 28, 32, /* vertical 75.028 Hz */ - /* pixel 78.749 MHz */ - }, - { 1024, 768, 70, - 24, 144, 304, /* horizontal 56.604 KHz */ - 3, 29, 38, /* vertical 70.227 Hz */ - /* pixel 75.170 MHz */ - }, - { 1024, 768, 66, - 24, 144, 304, /* horizontal 53.234 KHz */ - 3, 29, 38, /* vertical 66.047 Hz */ - /* pixel 70.695 MHz */ - }, - - { 1152, 900, 85, - 48, 208, 384, /* horizontal 79.900 KHz */ - 1, 32, 38, /* vertical 85.181 Hz */ - /* pixel 122.726 MHz */ - }, - { 1152, 900, 75, - 32, 208, 384, /* horizontal 70.495 Khz */ - 1, 32, 38, /* vertical 75.154 Hz */ - /* pixel 108.280 MHz */ - }, - { 1152, 900, 70, - 32, 208, 384, /* horizontal 65.251 KHz */ - 2, 32, 38, /* vertical 69.564 Hz */ - /* pixel 100.226 MHz */ - }, - { 1152, 900, 66, - 32, 208, 384, /* horizontal 61.817 KHz */ - 1, 32, 38, /* vertical 65.903 Hz */ - /* pixel 94.951 MHz */ - }, - { 1280, 1024, 85, - 16, 248, 416, /* horizontal 90.561 KHz */ - 1, 40, 45, /* vertical 84.717 Hz */ - /* pixel 153.593 MHz */ - }, - { 1280, 1024, 75, - 16, 248, 408, /* horizontal 80.255 KHz */ - 1, 38, 42, /* vertical 75.285 Hz */ - /* pixel 134.828 MHz */ - }, - { 1280, 1024, 70, - 32, 248, 400, /* horizontal 74.573 KHz */ - 0, 36, 39, /* vertical 70.153 Hz */ - /* pixel 125.283 MHz */ - }, - { 1280, 1024, 66, - 32, 248, 400, /* horizontal 70.007 KHz */ - 0, 36, 39, /* vertical 65.858 Hz */ - /* pixel 117.612 MHz */ - }, - - { 1600, 1200, 85, - 64, 304, 560, /* horizontal 106.059 KHz */ - 1, 46, 50, /* vertical 84.847 Hz */ - /* pixel 229.088 MHz */ - }, - { 1600, 1200, 75, - 64, 304, 560, /* horizontal 93.748 KHz */ - 1, 46, 50, /* vertical 74.999 Hz */ - /* pixel 202.497 MHz */ - }, - { 1600, 1200, 70, - 56, 304, 588, /* horizontal 87.524 KHz */ - 1, 46, 50, /* vertical 70.019 Hz */ - /* pixel 191.503 MHz */ - }, - { 1600, 1200, 65, - 56, 308, 524, /* horizontal 80.050 KHz */ - 1, 38, 42, /* vertical 64.453 Hz */ - /* pixel 170.026 MHz */ - }, +int sisMemoryTable[8] = { + 1, 2, 4, 0, 0, 2, 4, 8 }; -#define NUM_SIS_TIMINGS (sizeof (sisTimings) / sizeof (sisTimings[0])) - Bool sisCardInit (KdCardInfo *card) { @@ -161,19 +41,33 @@ sisCardInit (KdCardInfo *card) int size; CARD8 *registers; CARD8 *temp_buffer; + CARD8 save_sr5; sisc = (SisCardInfo *) xalloc (sizeof (SisCardInfo)); if (!sisc) goto bail0; - temp_buffer = KdMapDevice (card->attr.address[0], MAX_FB_SIZE); - if (!temp_buffer) - goto bail1; - - sisc->memory = KdFrameBufferSize (temp_buffer, MAX_FB_SIZE); + sisc->io_base = card->attr.io; + /* + * enable access to SiS ports (no MMIO available) + */ + iopl(3); + save_sr5 = GetSrtc(sisc,0x5); + if (save_sr5 != 0x21) + save_sr5 = 0x86; + PutSrtc(sisc,0x5,0x86); +#if 0 + { + int i; - KdUnmapDevice (temp_buffer, MAX_FB_SIZE); + for (i = 0; i <= 0x3f; i++) + fprintf (stderr, "SR%02x = %02x\n", i, GetSrtc(sisc,i)); + } +#endif + sisc->memory = sisMemoryTable[GetSrtc(sisc,0xc)&0x7] * 1024 * 1024; + PutSrtc(sisc,0x5,save_sr5); + if (!sisc->memory) { ErrorF ("Can't detect SiS530 frame buffer\n"); @@ -196,12 +90,7 @@ sisCardInit (KdCardInfo *card) */ sisc->sis = (SisPtr) (sisc->registers + SIS_MMIO_OFFSET); sisc->cpu_bitblt = (VOL32 *) sisc->registers; - sisc->io_base = card->attr.io; - /* - * enable access to SiS ports (no MMIO available) - */ - ioperm (sisc->io_base, 0x80, 1); card->driver = sisc; return TRUE; @@ -212,22 +101,60 @@ bail1: bail0: return FALSE; } - -SisTiming * -sisGetTiming (int width, int height, int rate) + +Bool +sisModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) +{ + if (t->horizontal != 1600 && + t->horizontal != 1280 && + t->horizontal != 1152 && + t->horizontal != 1024 && + t->horizontal != 800 && + t->horizontal != 640) + return FALSE; + return TRUE; +} + +Bool +sisModeUsable (KdScreenInfo *screen) { - int i; - SisTiming *t; + KdCardInfo *card = screen->card; + SisCardInfo *sisc = (SisCardInfo *) card->driver; + SisScreenInfo *siss; + int i; + KdMonitorTiming *t; + CARD32 memory; + int byte_width, pixel_width, screen_size; - for (i = 0; i < NUM_SIS_TIMINGS; i++) + if (screen->fb[0].depth >= 24) + { + screen->fb[0].depth = 24; + screen->fb[0].bitsPerPixel = 24; + screen->dumb = TRUE; + } + else if (screen->fb[0].depth >= 16) + { + screen->fb[0].depth = 16; + screen->fb[0].bitsPerPixel = 16; + } + else if (screen->fb[0].depth >= 15) + { + screen->fb[0].depth = 15; + screen->fb[0].bitsPerPixel = 16; + } + else { - t = &sisTimings[i]; - if (t->horizontal >= width && - t->vertical >= height && - (!rate || t->rate <= rate)) - return t; + screen->fb[0].depth = 8; + screen->fb[0].bitsPerPixel = 8; } - return &sisTimings[SIS_TIMING_BAIL]; + byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); + pixel_width = screen->width; + screen->fb[0].pixelStride = pixel_width; + screen->fb[0].byteStride = byte_width; + + screen_size = byte_width * screen->height; + + return screen_size <= sisc->memory; } Bool @@ -237,7 +164,7 @@ sisScreenInit (KdScreenInfo *screen) SisCardInfo *sisc = (SisCardInfo *) card->driver; SisScreenInfo *siss; int i; - SisTiming *t; + const KdMonitorTiming *t; CARD32 memory; int byte_width, pixel_width, screen_size; @@ -256,117 +183,18 @@ sisScreenInit (KdScreenInfo *screen) if (!screen->fb[0].depth) screen->fb[0].depth = 8; - for (;;) - { - if (screen->fb[0].depth >= 24) - { - screen->fb[0].depth = 24; - screen->fb[0].bitsPerPixel = 24; - } - else if (screen->fb[0].depth >= 16) - { - screen->fb[0].depth = 16; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth >= 15) - { - screen->fb[0].depth = 15; - screen->fb[0].bitsPerPixel = 16; - } - else - { - screen->fb[0].depth = 8; - screen->fb[0].bitsPerPixel = 8; - } - - /* Normalize width to supported values */ - - if (screen->width >= 1600) - screen->width = 1600; - else if (screen->width >= 1280) - screen->width = 1280; - else if (screen->width >= 1152) - screen->width = 1152; - else if (screen->width >= 1024) - screen->width = 1024; - else if (screen->width >= 800) - screen->width = 800; - else - screen->width = 640; - - byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[0].pixelStride = pixel_width; - screen->fb[0].byteStride = byte_width; - - screen_size = byte_width * screen->height; - - if (screen_size <= sisc->memory) - break; - - /* - * Fix requested depth and geometry until it works - */ - if (screen->fb[0].depth > 16) - screen->fb[0].depth = 16; - else if (screen->fb[0].depth > 8) - screen->fb[0].depth = 8; - else if (screen->width > 1152) - { - screen->width = 1152; - screen->height = 900; - } - else if (screen->width > 1024) - { - screen->width = 1024; - screen->height = 768; - } - else if (screen->width > 800) - { - screen->width = 800; - screen->height = 600; - } - else if (screen->width > 640) - { - screen->width = 640; - screen->height = 480; - } - else - { - xfree (siss); - return FALSE; - } - } + t = KdFindMode (screen, sisModeSupported); - t = sisGetTiming (screen->width, screen->height, screen->rate); screen->rate = t->rate; screen->width = t->horizontal; screen->height = t->vertical; - /* - * Take requested geometry and adjust to fit possible geometries - */ - switch (screen->fb[0].depth) { - case 4: - screen->fb[0].bitsPerPixel = 4; - break; - case 8: - screen->fb[0].bitsPerPixel = 8; - break; - case 15: - case 16: - screen->fb[0].bitsPerPixel = 16; - break; - case 24: - case 32: - screen->fb[0].bitsPerPixel = 24; - screen->dumb = TRUE; - break; + if (!KdTuneMode (screen, sisModeUsable, sisModeSupported)) + { + xfree (sisc); + return FALSE; } - screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >> 3); - screen->fb[0].pixelStride = screen->width; - memory = sisc->memory - screen_size; screen->fb[0].frameBuffer = sisc->frameBuffer; @@ -451,10 +279,12 @@ _sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc) crtc->crtc_overflow = GetCrtc (sisc, 0x07); crtc->preset_row_scan = GetCrtc (sisc, 0x08); crtc->_max_scan_line = GetCrtc (sisc, 0x09); - + crtc->cursor_start = GetCrtc (sisc, 0x0a); + crtc->cursor_end = GetCrtc (sisc, 0x0a); crtc->start_address_8_15 = GetCrtc (sisc, 0x0c); crtc->start_address_0_7 = GetCrtc (sisc, 0x0d); - + crtc->text_cursor_15_8 = GetCrtc (sisc, 0x0e); + crtc->text_cursor_7_0 = GetCrtc (sisc, 0x0f); crtc->v_retrace_start_0_7 = GetCrtc (sisc, 0x10); crtc->_v_retrace_end = GetCrtc (sisc, 0x11); crtc->v_display_end_0_7 = GetCrtc (sisc, 0x12); @@ -472,8 +302,12 @@ _sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc) crtc->horizontal_pixel_pan = GetArtc (sisc, 0x13); crtc->mode_register = GetGrtc (sisc, 0x5); + crtc->misc_register = GetGrtc (sisc, 0x6); + crtc->color_dont_care = GetGrtc (sisc, 0x7); crtc->clock_mode = GetSrtc (sisc, 0x1); + crtc->color_plane_w_enable = GetSrtc (sisc, 0x2); + crtc->memory_mode = GetSrtc (sisc, 0x4); crtc->graphics_mode = GetSrtc (sisc, 0x6); crtc->misc_control_0 = GetSrtc (sisc, 0x7); @@ -530,7 +364,6 @@ _sisSetBlank (SisCardInfo *sisc, Bool blank) static void _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) { - _sisOutb(crtc->misc_output, sisc->io_base+0x4c); _sisSetBlank (sisc, TRUE); PutCrtc (sisc, 0x00, crtc->h_total_0_7); PutCrtc (sisc, 0x01, crtc->h_display_end_0_7); @@ -542,10 +375,12 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) PutCrtc (sisc, 0x07, crtc->crtc_overflow); PutCrtc (sisc, 0x08, crtc->preset_row_scan); PutCrtc (sisc, 0x09, crtc->_max_scan_line); - + PutCrtc (sisc, 0x0a, crtc->cursor_start); + PutCrtc (sisc, 0x0b, crtc->cursor_end); PutCrtc (sisc, 0x0c, crtc->start_address_8_15); PutCrtc (sisc, 0x0d, crtc->start_address_0_7); - + PutCrtc (sisc, 0x0e, crtc->text_cursor_15_8); + PutCrtc (sisc, 0x0f, crtc->text_cursor_7_0); PutCrtc (sisc, 0x10, crtc->v_retrace_start_0_7); PutCrtc (sisc, 0x11, crtc->_v_retrace_end); PutCrtc (sisc, 0x12, crtc->v_display_end_0_7); @@ -562,8 +397,12 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) PutArtc (sisc, 0x13, crtc->horizontal_pixel_pan); PutGrtc (sisc, 0x5, crtc->mode_register); + PutGrtc (sisc, 0x6, crtc->misc_register); + PutGrtc (sisc, 0x7, crtc->color_dont_care); PutSrtc (sisc, 0x1, crtc->clock_mode | 0x20); + PutSrtc (sisc, 0x2, crtc->color_plane_w_enable); + PutSrtc (sisc, 0x4, crtc->memory_mode); PutSrtc (sisc, 0x6, crtc->graphics_mode); PutSrtc (sisc, 0x7, crtc->misc_control_0); @@ -603,6 +442,24 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) PutSrtc (sisc, 0x3E, crtc->misc_control_11); PutSrtc (sisc, 0x3F, crtc->misc_control_12); +#if 0 + PutCrtc (sisc, 0x5b, 0x27); + PutCrtc (sisc, 0x5c, 0xe1); + PutCrtc (sisc, 0x5d, 0x00); + + PutSrtc (sisc, 0x5a, 0xe6); + PutSrtc (sisc, 0x5d, 0xa1); + PutSrtc (sisc, 0x9a, 0xe6); + PutSrtc (sisc, 0x9d, 0xa1); + PutSrtc (sisc, 0xda, 0xe6); + PutSrtc (sisc, 0xdd, 0x6c); +#endif + + _sisOutb(crtc->misc_output, sisc->io_base+0x42); + + outw (0x3c4, 0x0100); + outw (0x3c4, 0x0300); + _sisSetBlank (sisc, FALSE); } @@ -623,6 +480,29 @@ _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value) _sisOutb (value, base+1); } +CARD8 +_sisReadArtc (CARD32 base, CARD8 index) +{ + CARD8 ret; + + _sisInb (base+0x1a); + _sisOutb (index,base); + ret = _sisInb (base+1); + _sisInb (base+0x1a); + _sisOutb (0x20,base); + return ret; +} + +void +_sisWriteArtc (CARD32 base, CARD8 index, CARD8 value) +{ + _sisInb (base+0x1a); + _sisOutb (index|0x20,base); + _sisOutb (value,base); + _sisInb (base+0x1a); + _sisOutb (0x20,base); +} + void sisPreserve (KdCardInfo *card) { @@ -638,11 +518,16 @@ sisPreserve (KdCardInfo *card) sisc->save.sr5 = 0x86; /* unlock extension registers */ PutSrtc(sisc,0x5,0x86); + /* unlock CRTC registers */ + PutCrtc(sisc,0x11,GetCrtc(sisc,0x11)&~0x80); + /* enable vga */ + _sisOutb(0x1,sisc->io_base+0x43); /* enable MMIO access to registers */ sisc->save.srb = GetSrtc(sisc,0xb); PutSrtc(sisc, 0xb, sisc->save.srb | 0x60); _sisGetCrtc (sisc, &sisc->save.crtc); + memcpy (sisc->save.text_save, sisc->frameBuffer, SIS_TEXT_SAVE); } void @@ -653,7 +538,7 @@ sisEnable (ScreenPtr pScreen) KdCardInfo *card = pScreenPriv->card; SisCardInfo *sisc = card->driver; SisScreenInfo *siss = screen->driver; - SisTiming *t; + const KdMonitorTiming *t; SisCrtc crtc; unsigned long pixel; @@ -686,28 +571,64 @@ sisEnable (ScreenPtr pScreen) crtc = sisc->save.crtc; - t = sisGetTiming (screen->width, screen->height, screen->rate); + t = KdFindMode (screen, sisModeSupported); + + /* CR9 */ + crtc.max_scan_line = 0; + + /* CRA */ + crtc.cursor_start = 0; + + /* CRB */ + crtc.cursor_end = 0; + + /* CRE */ + crtc.text_cursor_15_8 = 0; + + /* CRF */ + crtc.text_cursor_7_0 = 0; /* CR11 */ crtc.disable_v_retrace_int = 1; + /* CR14 */ + crtc.underline_location = 0; + crtc.count_by_four = 0; + crtc.doubleword_mode = 1; + /* 3CC/3C2 */ crtc.io_address_select = 1; crtc.display_ram_enable = 1; crtc.clock_select = 3; + /* SR1 */ + crtc.clock_mode = 0; + crtc.dot_clock_8_9 = 1; + + /* SR2 */ + crtc.color_plane_w_enable = 0xf; + + /* SR4 */ + crtc.memory_mode = 0; + crtc.chain_4_enable = 1; + crtc.odd_even_disable = 1; + crtc.extended_memory_sz = 1; + /* SR6 */ - crtc.graphics_mode = 0; crtc.graphics_mode_linear = 1; crtc.enhanced_graphics_mode = 1; + /* SR9 */ + crtc.crt_cpu_threshold_control_1 = 0; + /* SRB */ +#if 0 crtc.cpu_bitblt_enable = 1; +#endif crtc.memory_mapped_mode = 3; /* SRC */ crtc.graphics_mode_32bit_enable = 1; - crtc.text_mode_16bit_enable = 0; crtc.read_ahead_enable = 1; /* SR11 */ @@ -717,6 +638,24 @@ sisEnable (ScreenPtr pScreen) crtc.vga_standby = 0; crtc.vga_suspend = 0; + crtc.cursor_0_red = 0x3f; + crtc.cursor_0_green = 0x3f; + crtc.cursor_0_blue = 0x3f; + + /* SR20 */ + crtc.linear_base_19_26 = (card->attr.address[0] & 0x07f80000) >> 19; + + /* SR21 */ + crtc.linear_base_27_31 = (card->attr.address[0] & 0xf8000000) >> 27; + crtc.linear_aperture = SIS_LINEAR_APERTURE_4M; + + /* SR27 */ + crtc.logical_screen_width = 3; + crtc.graphics_prog_enable = 1; + + /* SR38 */ + crtc.extended_clock_select = 0; + /* AR10 */ crtc.mode_control = 0; crtc.graphics_mode_enable = 1; @@ -727,13 +666,16 @@ sisEnable (ScreenPtr pScreen) /* AR13 */ crtc.horizontal_pixel_pan = 0; - /* SR27 */ - crtc.logical_screen_width = 3; - crtc.graphics_prog_enable = 1; - - /* SR38 */ - crtc.extended_clock_select = 0; - + /* GR5 */ + crtc.mode_register = 0; + + /* GR6 */ + crtc.graphics_enable = 1; + crtc.chain_odd_even = 0; + crtc.memory_address_select = 1; + + /* GR7 */ + crtc.color_dont_care = 0xf; if (siss->cursor_base) { crtc_set_cursor_start_addr (&crtc, siss->cursor_off); @@ -861,6 +803,29 @@ sisEnable (ScreenPtr pScreen) crtc_set_v_blank_start (&crtc, v_blank_start); crtc.v_blank_end_0_7 = v_blank_end; +#if 0 + crtc.h_blank_start_0_7 = 0x6a; + crtc._h_blank_end = 0x9a; + crtc.h_sync_start_0_7 = 0x6b; + crtc._h_sync_end = 0x9a; + + crtc.v_retrace_start_0_7 = 0x7d; + crtc._v_retrace_end = 0x23; + crtc.v_blank_start_0_7 = 0x7d; + crtc.v_blank_end_0_7 = 0x84; + + crtc.crt_cpu_threshold_control_0 = 0xdf; /* SR8 */ + crtc.crt_cpu_threshold_control_1 = 0x00; /* SR9 */ + crtc.extended_clock_generator = 0x40; /* SR13 */ + + crtc.cursor_h_start_0_7 = 0x83; + crtc.cursor_v_start_0_7 = 0x6c; + + crtc.internal_vclk_0 = 0x68; + crtc.internal_vclk_1 = 0xc4; + crtc.misc_control_7 = 0x70; +#endif + _sisSetCrtc (sisc, &crtc); } @@ -905,6 +870,7 @@ sisRestore (KdCardInfo *card) { SisCardInfo *sisc = (SisCardInfo *) card->driver; + memcpy (sisc->frameBuffer, sisc->save.text_save, SIS_TEXT_SAVE); _sisSetCrtc (sisc, &sisc->save.crtc); PutSrtc (sisc, 0xb, sisc->save.srb); PutSrtc (sisc, 0x5, sisc->save.sr5); @@ -926,7 +892,6 @@ sisCardFini (KdCardInfo *card) KdUnmapDevice (sisc->frameBuffer, sisc->memory); KdUnmapDevice (sisc->registers, sizeof (SisRec)); - ioperm (sisc->io_base, 0x80, 0); } KdCardFuncs sisFuncs = { diff --git a/xc/programs/Xserver/hw/kdrive/sis530/sis.h b/xc/programs/Xserver/hw/kdrive/sis530/sis.h index 2bcb94bf3..686fee93d 100644 --- a/xc/programs/Xserver/hw/kdrive/sis530/sis.h +++ b/xc/programs/Xserver/hw/kdrive/sis530/sis.h @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.h,v 1.4 2000/05/06 22:17:49 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.h,v 1.5 2000/08/09 17:52:43 keithp Exp $ */ #ifndef _SIS_H_ #define _SIS_H_ @@ -194,6 +194,25 @@ typedef struct _sis530Trapezoid { /* 8254 */ } SisTrapezoid; +typedef struct _sisAccel { + VOL8 pad[0x80]; /* 8200 */ + VOL32 src_addr; /* 8280 */ + VOL32 dst_addr; /* 8284 */ + VOL32 pitch; /* 8288 */ + VOL32 dimension; /* 828c */ + VOL32 fg; /* 8290 */ + VOL32 bg; /* 8294 */ + + + VOL32 clip_ul; /* 82a0 */ + VOL32 clip_br; /* 82a4 */ + + VOL16 cmd; /* 82aa */ + + VOL8 pattern[256]; /* 82ac */ + +} SisAccel; + typedef struct _sis530 { union { SisGeneral general; @@ -201,6 +220,7 @@ typedef struct _sis530 { SisTransparent transparent; SisMultiple multiple; SisTrapezoid trapezoid; + SisAccel accel; } u; } SisRec, *SisPtr; @@ -307,26 +327,29 @@ typedef struct _crtc { union { struct { - CARD8 _max_scan_line : 5; + CARD8 ___max_scan_line : 5; CARD8 _v_blank_start_9 : 1; CARD8 _line_compare_9 : 1; - CARD8 _double_scan : 1; + CARD8 _double_scan : 1; } _max_scan_line_s; CARD8 __max_scan_line; /* CR9 */ } _max_scan_line_u; -#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line +#define max_scan_line _max_scan_line_u._max_scan_line_s.___max_scan_line #define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9 #define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9 #define double_scan _max_scan_line_u._max_scan_line_s._double_scan #define _max_scan_line _max_scan_line_u.__max_scan_line - CARD8 cursor_start; - CARD8 cursor_end; + CARD8 cursor_start; /* CRA */ + CARD8 cursor_end; /* CRB */ CARD8 start_address_8_15; /* CRC */ CARD8 start_address_0_7; /* CRD */ + CARD8 text_cursor_15_8; /* CRE */ + CARD8 text_cursor_7_0; /* CRF */ + CARD8 cursor_loc_high; CARD8 cursor_loc_low; @@ -355,7 +378,7 @@ typedef struct _crtc { union { struct { - CARD8 _underline_location : 5; + CARD8 ___underline_location : 5; CARD8 _count_by_four : 1; CARD8 _doubleword_mode : 1; CARD8 : 1; @@ -363,7 +386,7 @@ typedef struct _crtc { CARD8 __underline_location; /* CR14 */ } _underline_location_u; -#define underline_location _underline_location_u._underline_location_s._underline_location +#define underline_location _underline_location_u._underline_location_s.___underline_location #define count_by_four _underline_location_u._underline_location_s._count_by_four #define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode #define _underline_location _underline_location_u.__underline_location @@ -433,6 +456,24 @@ typedef struct _crtc { #define mode_register _mode_register_u._mode_register #define color_mode_256 _mode_register_u._mode_register_s._color_mode_256 +#define odd_even_addressing _mode_register_u._mode_register_s._odd_even_addressing + + union { + struct { + CARD8 _graphics_enable : 1; + CARD8 _chain_odd_even : 1; + CARD8 _memory_address_select : 2; + CARD8 : 4; + } _misc_register_s; + CARD8 _misc_register; + } _misc_register_u; /* GR6 */ + +#define misc_register _misc_register_u._misc_register +#define graphics_enable _misc_register_u._misc_register_s._graphics_enable +#define chain_odd_even _misc_register_u._misc_register_s._chain_odd_even +#define memory_address_select _misc_register_u._misc_register_s._memory_address_select + + CARD8 color_dont_care; /* GR7 */ union { struct { @@ -454,6 +495,24 @@ typedef struct _crtc { #define shifter_load_32 _clock_mode_u._clock_mode_s._shifter_load_32 #define display_off _clock_mode_u._clock_mode_s._display_off + CARD8 color_plane_w_enable; /* SR2 */ + + union { + struct { + CARD8 : 1; + CARD8 _extended_memory_size : 1; + CARD8 _odd_even_disable : 1; + CARD8 _chain_4_enable : 1; + CARD8 : 4; + } _memory_mode_s; + CARD8 _memory_mode; + } _memory_mode_u; /* SR4 */ + +#define memory_mode _memory_mode_u._memory_mode +#define extended_memory_sz _memory_mode_u._memory_mode_s._extended_memory_size +#define odd_even_disable _memory_mode_u._memory_mode_s._odd_even_disable +#define chain_4_enable _memory_mode_u._memory_mode_s._chain_4_enable + union { struct { CARD8 _enhanced_text_mode : 1; @@ -700,6 +759,7 @@ typedef struct _crtc { #define linear_base_1 _linear_base_1_u._linear_base_1 #define linear_base_27_31 _linear_base_1_u._linear_base_1_s._linear_base_27_31 +#define linear_aperture _linear_base_1_u._linear_base_1_s._linear_aperture union { struct { @@ -1027,8 +1087,8 @@ typedef struct _crtc { #define GetSrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x44,i) #define PutSrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x44,i,v) -#define GetArtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x40,i) -#define PutArtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x40,i,v) +#define GetArtc(sisc,i) _sisReadArtc ((sisc)->io_base+0x40,i) +#define PutArtc(sisc,i,v) _sisWriteArtc ((sisc)->io_base+0x40,i,v) #define GetGrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x4e,i) #define PutGrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x4e,i,v) @@ -1053,10 +1113,13 @@ typedef struct _sisTiming { int vblank; /* blanking */ } SisTiming; +#define SIS_TEXT_SAVE (64*1024) + typedef struct _sisSave { CARD8 srb; CARD8 sr5; SisCrtc crtc; + CARD8 text_save[SIS_TEXT_SAVE]; } SisSave; typedef struct _sisCardInfo { @@ -1109,6 +1172,8 @@ void SISInitCard (KdCardAttr *attr); CARD8 _sisReadIndexRegister (CARD32 base, CARD8 index); void _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value); +CARD8 _sisReadArtc (CARD32 base, CARD8 index); +void _sisWriteArtc (CARD32 base, CARD8 index, CARD8 value); extern KdCardFuncs sisFuncs; diff --git a/xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c b/xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c index 68b64af93..1863b9011 100644 --- a/xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c +++ b/xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c,v 1.4 2000/05/06 22:17:50 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c,v 1.5 2000/08/09 17:52:44 keithp Exp $ */ #include "sis.h" #include "sisdraw.h" @@ -1635,11 +1635,15 @@ sisDrawEnable (ScreenPtr pScreen) CARD32 cmd; CARD32 base; CARD16 stride; + CARD16 op; base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer; stride = pScreenPriv->screen->fb[0].byteStride; +#if 0 sis->u.general.dst_base = base; sis->u.general.dst_pitch = stride; + sis->u.general.src_pitch = stride; + sis->u.general._pad0 = stride; sis->u.general.dst_height = pScreenPriv->screen->height; _sisClip (sis, 0, 0, pScreenPriv->screen->width, pScreenPriv->screen->height); @@ -1647,6 +1651,53 @@ sisDrawEnable (ScreenPtr pScreen) _sisRect (sis, 0, 0, pScreenPriv->screen->width, pScreenPriv->screen->height, cmd); +#endif + base = (CARD32) (pScreenPriv->screen->fb[0].frameBuffer); + fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); + sis->u.accel.src_addr = (base & 0x3fffff); + fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); + sis->u.accel.dst_addr = (base & 0x3fffff); + sis->u.accel.pitch = (stride << 16) | stride; + sis->u.accel.dimension = ((pScreenPriv->screen->height-1) << 16 | + (pScreenPriv->screen->width - 1)); + sis->u.accel.fg = (sisBltRop[GXcopy] << 24) | 0xf800; + sis->u.accel.bg = (sisBltRop[GXcopy] << 24) | 0x00; + +#define sisLEFT2RIGHT 0x10 +#define sisRIGHT2LEFT 0x00 +#define sisTOP2BOTTOM 0x20 +#define sisBOTTOM2TOP 0x00 + +#define sisSRCSYSTEM 0x03 +#define sisSRCVIDEO 0x02 +#define sisSRCFG 0x01 +#define sisSRCBG 0x00 + +#define sisCMDBLT 0x0000 +#define sisCMDBLTMSK 0x0100 +#define sisCMDCOLEXP 0x0200 +#define sisCMDLINE 0x0300 + +#define sisCMDENHCOLEXP 0x2000 + +#define sisXINCREASE 0x10 +#define sisYINCREASE 0x20 +#define sisCLIPENABL 0x40 +#define sisCLIPINTRN 0x80 +#define sisCLIPEXTRN 0x00 + + +#define sisPATREG 0x08 +#define sisPATFG 0x04 +#define sisPATBG 0x00 + +#define sisLASTPIX 0x0800 +#define sisXMAJOR 0x0400 + + op = sisCMDBLT | sisLEFT2RIGHT | sisTOP2BOTTOM | sisSRCFG | sisPATFG; + + sis->u.accel.cmd = op; + KdMarkSync (pScreen); } diff --git a/xc/programs/Xserver/hw/kdrive/sis530/sisstub.c b/xc/programs/Xserver/hw/kdrive/sis530/sisstub.c index afec4050e..185a82bb2 100644 --- a/xc/programs/Xserver/hw/kdrive/sis530/sisstub.c +++ b/xc/programs/Xserver/hw/kdrive/sis530/sisstub.c @@ -22,16 +22,23 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sisstub.c,v 1.3 2000/02/23 20:30:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sisstub.c,v 1.4 2000/08/09 17:52:44 keithp Exp $ */ #include "sis.h" +static const int sisCards[] = { 0x6306, 0x0200 }; + +#define numSisCards (sizeof (sisCards) / sizeof (sisCards[0])) + void InitCard (char *name) { KdCardAttr attr; - if (LinuxFindPci (0x1039, 0x6306, 0, &attr)) - KdCardInfoAdd (&sisFuncs, &attr, 0); + int i; + + for (i = 0; i < numSisCards; i++) + if (LinuxFindPci (0x1039, sisCards[i], 0, &attr)) + KdCardInfoAdd (&sisFuncs, &attr, (void *) sisCards[i]); } void diff --git a/xc/programs/Xserver/hw/kdrive/trio/s3.c b/xc/programs/Xserver/hw/kdrive/trio/s3.c index 82e0d68b7..476e406fe 100644 --- a/xc/programs/Xserver/hw/kdrive/trio/s3.c +++ b/xc/programs/Xserver/hw/kdrive/trio/s3.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/trio/s3.c,v 1.4 2000/05/06 22:17:52 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trio/s3.c,v 1.5 2000/08/09 17:52:45 keithp Exp $ */ #include "s3.h" @@ -429,11 +429,13 @@ s3ModeSupported (KdScreenInfo *screen, if (t->horizontal != 1600 && t->horizontal != 1280 && t->horizontal != 1152 && + t->horizontal != 1024 && t->horizontal != 800 && t->horizontal != 640) return FALSE; if (t->clock > S3_MAX_CLOCK * 2) return FALSE; + return TRUE; } Bool diff --git a/xc/programs/Xserver/hw/vfb/Imakefile b/xc/programs/Xserver/hw/vfb/Imakefile index 167bfc93e..7c3b9d1c9 100644 --- a/xc/programs/Xserver/hw/vfb/Imakefile +++ b/xc/programs/Xserver/hw/vfb/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/13 1998/03/24 13:27:03 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.21 2000/01/05 02:03:10 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.22 2000/08/10 17:40:31 dawes Exp $ #include <Server.tmpl> #if HasShm @@ -16,9 +16,14 @@ SRCS1 = os2_stubs.c OBJS1 = os2_stubs.o #endif -SRCSA = InitInput.c InitOutput.c stubs.c $(SRCS1) miinitext.c +#ifdef cygwinArchitecture +SRCS2 = ntux_xf.c +OBJS2 = ntux_xf.o +#endif + +SRCSA = InitInput.c InitOutput.c stubs.c $(SRCS1) miinitext.c $(SRCS2) -OBJSA = InitInput.o InitOutput.o stubs.o $(OBJS1) miinitext.o +OBJSA = InitInput.o InitOutput.o stubs.o $(OBJS1) miinitext.o $(OBJS2) INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \ diff --git a/xc/programs/Xserver/hw/vfb/InitInput.c b/xc/programs/Xserver/hw/vfb/InitInput.c index cf4d883fd..0fe50f180 100644 --- a/xc/programs/Xserver/hw/vfb/InitInput.c +++ b/xc/programs/Xserver/hw/vfb/InitInput.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/vfb/InitInput.c,v 3.4 1998/10/04 09:38:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/vfb/InitInput.c,v 3.5 2000/08/10 17:40:31 dawes Exp $ */ #include "X11/X.h" #define NEED_EVENTS @@ -44,6 +44,30 @@ from The Open Group. int xf86bpp = 8; #endif +#ifdef __CYGWIN__ +extern void init_mouse( ); +extern void init_keyboard( ); +extern void term_mouse( ); +extern void term_keyboard( ); +extern void get_WinMappings( char *pKeySyms, unsigned char *p_modMap ); + + +CARD32 lastEventTime = 0; + +int TimeSinceLastInputEvent() +{ + if (lastEventTime == 0) + lastEventTime = GetTimeInMillis(); + return GetTimeInMillis() - lastEventTime; +} + +void SetTimeSinceLastInputEvent() +{ + lastEventTime = GetTimeInMillis(); +} +#endif + + Bool LegalModifier(key, pDev) unsigned int key; @@ -260,6 +284,74 @@ GetLK201Mappings(pKeySyms, pModMap) #undef INDEX } +#ifdef __CYGWIN__ +static int +winKeybdProc(pDevice, onoff) + DeviceIntPtr pDevice; + int onoff; +{ + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + int i; + DevicePtr pDev = (DevicePtr)pDevice; + + switch (onoff) + { + case DEVICE_INIT: + get_WinMappings(&keySyms, modMap); + InitKeyboardDeviceStruct(pDev, &keySyms, modMap, + (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA); + init_keyboard(); + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + pDev->on = FALSE; + break; + case DEVICE_CLOSE: + term_keyboard(); + break; + } + return Success; +} + +static int +winMouseProc(pDevice, onoff) + DeviceIntPtr pDevice; + int onoff; +{ + BYTE map[4]; + DevicePtr pDev = (DevicePtr)pDevice; + + switch (onoff) + { + case DEVICE_INIT: + map[1] = 1; + map[2] = 2; + map[3] = 3; + InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents, + (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize()); + init_mouse(); + break; + + case DEVICE_ON: + pDev->on = TRUE; + break; + + case DEVICE_OFF: + pDev->on = FALSE; + break; + + case DEVICE_CLOSE: + term_mouse(); + break; + } + return Success; +} +#endif /* __CYGWIN__ */ + + static int vfbKeybdProc(pDevice, onoff) DeviceIntPtr pDevice; diff --git a/xc/programs/Xserver/hw/vfb/InitOutput.c b/xc/programs/Xserver/hw/vfb/InitOutput.c index 1c70c981f..16d8d40ec 100644 --- a/xc/programs/Xserver/hw/vfb/InitOutput.c +++ b/xc/programs/Xserver/hw/vfb/InitOutput.c @@ -22,9 +22,9 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.11 1999/05/14 14:11:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.12 2000/08/10 17:40:31 dawes Exp $ */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) #include <X11/Xwinsock.h> #endif #include <stdio.h> @@ -55,12 +55,29 @@ from The Open Group. #endif #include <X11/XWDFile.h> #ifdef HAS_SHM +#ifndef __CYGWIN__ #include <sys/ipc.h> +#else +#include <sys/cygipc.h> +#endif #include <sys/shm.h> #endif /* HAS_SHM */ #include "dix.h" #include "miline.h" +#ifdef __CYGWIN__ +/* + * NT UX defines/includes + */ +#include <sys/mman.h> + +#define HAS_MMAP 1 + +extern char *get_surf( unsigned long size ); +extern char *get_framebuf( unsigned long size ); +extern int enable_ntux_xf( ); +#endif /* __CYGWIN__ */ + extern char *display; #define VFB_DEFAULT_WIDTH 1280 @@ -107,6 +124,10 @@ static fbMemType fbmemtype = NORMAL_MEMORY_FB; static char needswap = 0; static int lastScreen = -1; +#ifdef __CYGWIN__ +static int b_video_memory = 0; +#endif + #define swapcopy16(_dst, _src) \ if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \ else _dst = _src; @@ -193,6 +214,9 @@ ddxGiveUp() case NORMAL_MEMORY_FB: for (i = 0; i < vfbNumScreens; i++) { +#ifdef __CYGWIN__ + if (!b_video_memory) +#endif Xfree(vfbScreens[i].pXWDHeader); } break; @@ -752,7 +776,17 @@ vfbAllocateFramebufferMemory(pvfb) { pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader + SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN); +#ifndef __CYGWIN__ pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors); +#else + pvfb->pfbMemory = + (char *)get_framebuf((unsigned long) + pvfb->paddedWidth * pvfb->height); + if (pvfb->pfbMemory) + b_video_memory = 1; + else + pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors); +#endif return pvfb->pfbMemory; } else @@ -943,6 +977,11 @@ InitOutput(screenInfo, argc, argv) int NumFormats = 0; FILE *pf = stderr; + +#ifdef __CYGWIN__ + enable_ntux_xf(); +#endif + /* initialize pixmap formats */ /* must have a pixmap depth to match every screen depth */ diff --git a/xc/programs/Xserver/hw/vfb/ntux_xf.c b/xc/programs/Xserver/hw/vfb/ntux_xf.c new file mode 100644 index 000000000..1f813a01f --- /dev/null +++ b/xc/programs/Xserver/hw/vfb/ntux_xf.c @@ -0,0 +1,133 @@ +/* +* Copyright 2000 (C) Peter Busch +* All rights reserved. +NO WARRANTY; NO LIABILITY FOR DAMAGES: THE MATERIALS ARE PROVIDED "AS IS" +WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES +OF SATISFACTORY QUALITY, MERCHANTABILITY, NONINFRINGEMENT OF THIRD-PARTY +INTELLECTUAL PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. +IN NO EVENT SHALL Peter Busch BE LIABLE FOR ANY DAMAGES WHATSOEVER +(INCLUDING, WITHOUT LIMITATION, DIRECT OR INDIRECT DAMAGES, DAMAGES FOR +LOSS OF PROFITS, BUSINESS INTERRUPTION, LOSS OF INFORMATION) ARISING OUT +OF THE USE OF OR INABILITY TO USE THE MATERIALS, EVEN IF +Peter Busch HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +Without limiting the generality of the foregoing, no warranty is made +that the enclosed software will generate computer programs with the +characteristics or specifications desired by you or that the demo +software will be error-free. +THESE DISCLAIMERS OF WARRANTY CONSTITUTE AN ESSENTIAL PART OF THIS +AGREEMENT. +*/ +/* $XFree86: xc/programs/Xserver/hw/vfb/ntux_xf.c,v 3.1 2000/08/10 17:40:31 dawes Exp $ */ + +/* +* ntux_xf.c +* support code for the output enabled X vfb server +* contains the interface between the vfb source files and the ntux_ddx library +* Copyright (C) Peter Busch +* All rights reserved. +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* This code is BETA and will be part of the CYGWIN/XFREE Project. +* It may not be used for purposes other than to contribute to the +* CYGWIN/XFree project without prior written notice from the +* author. +* Any commercial use of this code will be permitted +* provided you contact Peter Busch at pbusch@dfki.de +*/ + + + +#include <windows.h> +#include <stdio.h> +#include "keysym.h" + + +typedef char * (* _get_surface)( unsigned long size ); +typedef int (* _init_input)( void ); +typedef void (* _init_mouse)( ); +typedef void (* _init_keyboard)( ); +typedef void (* _term_mouse)( ); +typedef void (* _term_keyboard)( ); +typedef void (* _get_WinMap)( char *pKeySyms, unsigned char *p_modMap ); + + +HINSTANCE h_ntux_ddx = NULL; + +_get_surface ntux_surface = NULL; +_init_input init_input = NULL; +_init_mouse ntux_init_mouse = NULL; +_init_keyboard ntux_init_keyboard = NULL; +_term_mouse ntux_term_mouse = NULL; +_term_keyboard ntux_term_keyboard = NULL; +_get_WinMap ntux_getWinMap = NULL; + +int enable_ntux_xf( ) +{ + h_ntux_ddx = LoadLibrary( "ntux_ddx.dll" ); + if( h_ntux_ddx == NULL ) + return 0; + + ntux_surface = (_get_surface)GetProcAddress( h_ntux_ddx, "get_surface" ); + init_input = (_init_input)GetProcAddress( h_ntux_ddx, "init_input" ); + ntux_init_mouse = (_init_mouse)GetProcAddress( h_ntux_ddx, "init_mouse" ); + ntux_init_keyboard = (_init_keyboard)GetProcAddress( h_ntux_ddx, "init_keyboard" ); + ntux_term_mouse = (_term_mouse)GetProcAddress( h_ntux_ddx, "term_mouse" ); + ntux_term_keyboard = (_term_keyboard)GetProcAddress( h_ntux_ddx, "term_keyboard" ); + ntux_getWinMap = (_get_WinMap)GetProcAddress( h_ntux_ddx, "get_WinMap" ); + + OutputDebugString( "\nntux_ddx successfully loaded\n\n" ); + return 1; +} + + +char *get_framebuf( unsigned long size ) +{ + char msg[256]; + if( ntux_surface != NULL ) + { + fprintf( stderr, "get_framebuf : calling %08x with size = %08x\n", + ntux_surface, size + ); + return ntux_surface( size ); + } + return NULL; +} + + +void init_mouse( ) +{ + if( ntux_init_mouse != NULL ) + return ntux_init_mouse(); + return ; +} + +void init_keyboard( ) +{ + if( ntux_init_keyboard != NULL ) + return ntux_init_keyboard(); + return ; +} + +void term_mouse( ) +{ + if( ntux_term_mouse != NULL ) + return ntux_term_mouse(); + return ; +} + +void term_keyboard( ) +{ + if( ntux_term_keyboard != NULL ) + return ntux_term_keyboard(); + return ; +} + +void get_WinMappings( char *pKeySyms, unsigned char *p_modMap ) +{ + if( ntux_getWinMap != NULL ) + return ntux_getWinMap( pKeySyms, p_modMap ); + return ; +} + + + diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG index 6f06897ad..bb3cb225f 100644 --- a/xc/programs/Xserver/hw/xfree86/CHANGELOG +++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG @@ -1,3 +1,176 @@ +XFree86 4.0.1b (11 August 2000) + 514. Fix the freetype font renderer's handling of True Type Collections + (.ttc files) (based on #A.123, timecop at japan.co.jp). + 513. Add PCI IDs for Silicon Motion, Inc (#A.122, Martin Dalecki). + 512. Fix a problem with the sequence number not being byte-swapped + for the reply to the DPMSCapable request (#A.120, Stephen Tse). + 511. Fix input driver PreInit funtions to behave as expected by InitInput() + (David Dawes). + 510. Port the spaceorb input driver to 4.x (Guido Heumer). + 509. Port the Summa input driver to 4.x (#A.116, Peter Schlaile). + 508. Add a DigitalEdge input driver (#A.116, Peter Schlaile). + 507. Remove obsolete PC98 code (#4081, Takaaki Nomura). + 506. Fix PC98 keyboard problems (#4081, Osamu Tomita). + 505. Imake support for building on Linux/arm32 (#4080, Andrew E. Mileski). + 504. Fix a problem with restoring the PIXCONF register in the i810 driver + (#4078, Jonathan Bian). + 503. Fix a build problem with the sis dri driver Imakefile (#4076, + Takaaki Nomura). + 502. Add DPMS support to the fbdev driver (#4075, Ani Joshi). + 501. Add DPMS support to the fbdevhw module (#4074, Ani Joshi). + 500. Fix VGA detection bug with Mach64 integrated controllers + (Marc La France). + 499. Accelerated line support for the NV driver (Chas Inman, Mark Vojkovich). + 498. Add GeForce2 support to the NV driver (Chas Inman). + 497. Integrate Cygwin support. To compile, this requires Cygwin 1.0 or + later with gcc 2.95.2 and Windows NT (#4073, Suhaib M. Siddiqi). + 496. Add en_GB.ISO8859-15 to locale.dir (David Dawes) + 495. Build int10 on all platforms and move ATI driver after r128 driver in + compiled-in probe lists (Marc La France, Michael Madore). + 494. Fix bug in parser code: addNewOption2() trunkates option list + when an option is added that already exists (Egbert Eich). + 493. Fix tmp file problem with makedepend scripts (based on report from + Alan Cox). + 492. ATI driver changes (Marc La France): + - Fix resource relocation bug. + - An attempt at fixing problems reported with Chrontel 8398's. + - Workaround for Mobility BIOS bug that affected the driver's ability to + restore the mode on server entry. + - Fix SEGV that occurs with ATI adapter BIOS'es that do not support some + flavour of VBE. + - Allow the driver to tolerate the absence of an initialised adapter BIOS + image and introduce XF86Config options for the information the driver + would otherwise require from it. + - Recognise more cases where a DFP panel might be in use. + - Fix minor bug that occurred on xf86SetDepthBpp() failures. + - Implement a compilation option that produces an MMIO-only version of + the driver. Intended for non-Intel architectures. See the driver's + Imakefile for details. + 491. fixed handling of backwards compatibility in xvmode (Egbert Eich). + 490. fixed changing mouse protocol with xf86misc extensions (Egbert Eich). + 489. added code to sanitize uninitialized PCI config space + base addresses (Egbert Eich). + 488. Changed xf86xv.c to call StopVideo(exit=TRUE) even + if StopVideo(exit=FALSE) has already been sent (Egbert Eich). + 487. fixed core dump in C&T video driver when vt switching + Changed C&T video driver to only register a block handler + when StopVideo() is called with exit = TRUE (Egbert Eich). + 486. Fixed Cirrus driver not segfault when termineated while + switched away (Egbert Eich). + 485. Neomagic driver: select sw cursor when screen stretching is + enabled (Egbert Eich). + 484. Neomagic driver: fixed problem with screen to screen copy + on 2200 chipsets (Egbert Eich). + 483. Neomagic driver: fixed 'white screen problem' by implementing + a signal save delay routine (Egbert Eich). + 482. r128 driver: Fixed colormap set problem when server is switched + away (Egbert Eich). + 481. r128 driver Added reinitialization of accel engine after vt switch. + 480. fixed a fg/bg color problem in SiS driver (Egbert Eich). + 479. attempt to address some problems with Cyber LCD chipsets in + Trident driver (Egbert Eich). + 478. tseng driver: Implemented correct MMIO handling (Egbert Eich). + 477. tseng driver: made accel driver multi screen capable (Egbert Eich). + 476. fixed vgaHW driver to use forground color for readability + test of pallette registers. This prevents annoying flashing + screen on server start (Egbert Eich). + 475. added module/font/rgb path parameters to xf86cfg (Egbert Eich). + +XFree86 4.0.1a (2 August 2000) + 474. i810 DRI updates (Jeff Hartmann). + 473. i810 driver updates (H. J. Lu). + 472. Save/restore the text mode colourmap for Solaris, to fix a blank + screen problem on Solaris 8 after exiting the X server (#A.104, + Richard Coley). + 471. Patch for SuperProbe on Linux with devfs (#A.103, Adam J. Richter). + 470. Enable BSD/gcc-2.95.2 workaround for BSD/OS 4.2 (#4072, Kurt Lidl). + 469. Fix a problem with the header symlinks in Xserver/GL/mesa/include/GL + (#4071, Matthieu Herrb). + 468. Finish integrating the SiS DRI driver support (Can-Ru Yeou, SiS). + 467. Change references to the Mesa source directory in Imakefiles to + $(MESASRCDIR) (David Dawes). + 467. Fix a typo an error in the example code in the XtAppAddInput man page + (#4070, Carlos A. M. dos Santos). + 466. Imstt driver updates, including moving from cfb to fb, fixing fbdev + bugs and an accel blit bug, and a general cleanup (#4068, Ani Joshi). + 465. Fix the installation path of the xditview bitmap (#4067, + Carlos A. M. dos Santos). + 464. Some xf86cfg fixes (#4065, 4068, Paulo Cesar Pereira de Andrade). + 463. Fix some syntax errors in xkb config files and a size mismatch between + two xkbcomp structures that were being masked one to another (#4063, + Paulo Cesar Pereira de Andrade). + 462. Fix a problem where the xkbcomp would read junk data from the server + if SmartScheduleTimer() is called while writing to it (#4063, + Paulo Cesar Pereira de Andrade). + 461. Increase MAXVISUALSPERDEPTH further for Xnest so that it will work + with GLX (#4062, Harald Koenig). + 460. Xv overlay support for the Intel i810 chipset (#4061, Jonathan Bian, + Matthew J Sottek, Intel). + 459. Penmount touch panel input driver (#4060, Mayk Langer). + 458. Fix the r128 SaveScreen function so that it doesn't touch the hardware + when switched away (#4056, Benjamin Herrenschmidt). + 457. Add support to xman for FreeBSD's /etc/manpath.config (#4055, + Carlos A M dos Santos). + 456. Update Xinstall.sh to handle the different behaviour of ldconfig + 2.1.3 (used on SuSE 6.4) (#4058, Michael Rohleder). + 455. Fix incorrect use of xf86{En,Dis}ableInterrupts() for ppc + (Marc La France). + 454. Add man pages for pcitweak and scanpci (David Dawes). + 453. Fix problems with xkb "Internet" keyboard mapping support (David Dawes). + 452. A few corrections to PIO and MMIO definitions affecting mips, arm32, + powerpc architectures and QNX4 (Marc La France). + 451. Minor int10 and VBE fixups (Marc La France). + 450. For frequency options, don't clobber the old value before verifying the + new one is valid (Marc La France). + 449. Ensure xf86_ansic.h is always #include'd before compiler.h in code + that can be compiled as a module (even for the static server). Generate + an error if not (Marc La France). + 448. Make linux/int10 module complain when SystemV IPC isn't configured + into the kernel (Marc La France). + 447. Add new offscreen frame bufffer manager functions for managing linear + offscreen areas (Mark Vojkovich). + 446. int10 fixes and remove checksum verification (Marc La France). + 445. More message formatting changes for DDC (Marc La France). + 444. Add missing xf86write symbol (Marc La France). + 443. Fix open(, O_CREAT) emulation (Marc La France). + 442. Fix Trident Cyber9320 > 8bpp modes (Alan Hourihane). + 441. Allow memory mapping during probe phase (Marc La France). + 440. Clean up os-support/dgux/dgux_video.c (Marc La France). + 439. Fix int10 bug that prevented recognition of video BIOS'es that are part + of the system BIOS (Marc La France). + 438. MGA driver warning fix (Marc La France). + 437. An update to change 425 (Marc La France). + 436. More EDID formatting changes (Marc La France). + 435. Fix bug that caused the relocation of PCI I/O bases assigned to multiples + of 0x0100 (but not 0x0400) by the system BIOS (Marc La France). + 434. Add ATI driver to Alpha, and experimentally, to ppc architectures. ppc + support is still known to be incomplete (Marc La France). + 433. For IA64, compile everything, except PEX, that is also compiled for IA32 + (Marc La France). + 432. Fix Cyrix driver for -configure (Alan Hourihane). + 431. Fix Glint PM3 memory detect when only 1MB of videoram (Alan Hourihane). + 430. Fix DAC colour problem and blank out issue in glint driver + (Alan Hourihane). + 429. Add missing clock values to the trident driver (Alan Hourihane). + 428. Fix Glint driver's SaveScreen function (#4057, Michel Danzer). + 427. Convert MGA driver to use fb instead of cfb (Mark Vojkovich). + 426. Rewrite MGA color expansion routines so that pci retries never occur + (Mark Vojkovich). + 425. Make ATI driver tolerate relocation of conflicting resources + (Marc La France). + 424. Make Mach64 FIFO handling available to GATOS (Marc La France). + 423. Fix bug in Mach64 scissor handling (Marc La France). + 422. Implement Mark Vojkovich's suggestions in the ATI driver + (LSB ordering of monochrome data and host transfer burst modes) + (Marc La France). + 421. More fixes to ATI DSP register calculation (Marc La France). + 420. ATI DGA support fixes for VGA Wonder capable adapters and the + setting of the DGA_CONCURRENT_ACCESS flag (Marc La France). + 419. Change imake to generate symbols for the GCC version used to + compile it (Marc La France). + 418. Fix xf1bpp/xf4bpp in trident driver and some planemask problems + (Alan Hourihane). + XFree86 4.0.1 (1 July 2000) 417. Update OpenBSD and NetBSD docs (#4053, Matthieu Herrb). 416. Fix segfault when destroying a GLX context (Kevin Martin). @@ -10817,4 +10990,4 @@ XFree86 3.0 (26 April 1994) -$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1230 2000/07/02 02:35:25 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1268 2000/08/11 21:12:44 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile index ea8f837e6..661d3218f 100644 --- a/xc/programs/Xserver/hw/xfree86/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/12 1996/12/16 12:31:46 rws $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.68 2000/06/13 02:28:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.69 2000/08/10 17:40:32 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -100,7 +100,7 @@ SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \ scanpci doc xf86config $(XF86CFGDIR) $(XF86SETUPDIR) dummylib etc \ $(SUPERPROBE) $(DRIVERSDK) $(XF8_32WIDDIR) -#ifndef OS2Architecture +#if !defined(OS2Architecture) && !defined(cygwinArchitecture) XF86CONFIG = XF86Config XF98CONFIG = XF98Config #else diff --git a/xc/programs/Xserver/hw/xfree86/OS_cygwin.c b/xc/programs/Xserver/hw/xfree86/OS_cygwin.c new file mode 100644 index 000000000..997815e8b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/OS_cygwin.c @@ -0,0 +1,221 @@ +/* + * (c) Copyright 1998,1999 by Sebastien Marineau <sebastien@qnx.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Orest Zborowski shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Orest Zborowski. + * + * $XFree86: xc/programs/Xserver/hw/xfree86/OS_cygwin.c,v 3.1 2000/08/10 17:40:32 dawes Exp $ + */ + +#include "Probe.h" + +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <unistd.h> +#include <windows.h> +#include <sys/mman.h> +#include <sys/cygwin.h> + +static int VT_fd = -1; +static int BIOS_fd = -1; + +/* + * OpenVideo -- + * + * Enable access to the installed video hardware. + */ +int OpenVideo() +{ + int fd; + char fn[20]; + + if (geteuid() != 0) { + fprintf(stderr, "%s: Must be run as root\n", MyName); + return(-1); + } + + if ((fd = open("/dev/conin", O_WRONLY, 0)) < 0) { + fprintf(stderr, "%s: Cannot open /dev/conin\n", MyName); + return(-1); + } + + return fd; +} + +/* + * CloseVideo -- + * + * Disable access to the video hardware. + */ +void CloseVideo() +{ + int fd; + + if (VT_fd > 0) { + close(VT_fd); + } +} + +/* + * MapVGA -- + * + * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for + * the process for use in probing memory. + */ +Byte *MapVGA() +{ + return( MapMem(0xA0000,0x10000) ); +} + +Byte *MapMem(address, size) + unsigned long address; + unsigned long size; +{ + int fd; + Byte *base; + + if ((fd = open("/dev/zero", O_RDWR)) < 0) { + fprintf(stderr, "%s: Failed to open /dev/zero\n", MyName); + return((Byte *)0); + } + + base = (Byte *)mmap((void *)0, size, PROT_READ|PROT_WRITE, + MAP_SHARED, fd, (off_t)address); + close(fd); + + if ((long)base == -1) { + fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); + return((Byte *)0); + } + + return base; +} + +/* + * UnMapVGA -- + * + * Unmap the VGA memory window. + */ +void UnMapVGA(base) + Byte *base; +{ + UnMapMem(base,0x10000); + return; +} + +void UnMapMem(base,size) + Byte *base; + unsigned long size; +{ + munmap((void *)base, size); + return; +} + +/* + * ReadBIOS -- + * + * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into + * buffer 'Buffer'. + */ +int ReadBIOS(Offset, Buffer, Len) +unsigned Offset; +Byte *Buffer; +int Len; +{ + Word tmp; + Byte *Base = Bios_Base + Offset; + Byte *mybase; + off_t myoffset; + int mysize; + + if (BIOS_fd == -1) { + if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) { + fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); + return(-1); + } + } + + if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) { + /* + * Sanity check... + */ + (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); + (void)read(BIOS_fd, &tmp, 2); + if (tmp != (Word)0xAA55) { + fprintf(stderr, "%s: BIOS sanity check failed, addr=%x\n", + MyName, (int)Base); + return(-1); + } + } + + if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) { + fprintf(stderr, "%s: BIOS seek failed\n", MyName); + return(-1); + } + + if (read(BIOS_fd, Buffer, Len) != Len) { + fprintf(stderr, "%s: BIOS read failed\n", MyName); + return(-1); + } + + return Len; +} + +/* + * EnableIOPort -- + * + * Enable access to 'NumPorts' IO ports listed in array 'Ports'. + */ + +/*ARGSUSED*/ +int EnableIOPorts(NumPorts, Ports) +CONST int NumPorts; +CONST Word *Ports; +{ + return(0); +} + +/* + * DisableIOPort -- + * + * Disable access to 'NumPorts' IO ports listed in array 'Ports'. + */ + +/*ARGSUSED*/ +int DisableIOPorts(NumPorts, Port) +CONST int NumPorts; +CONST Word *Port; +{ + return(0); +} + +/* + * ShortSleep -- + * + * Sleep for the number of milliseconds specified in 'Delay'. + */ +void ShortSleep(Delay) +int Delay; +{ + usleep(Delay * 1000); +} diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c index aade63de4..e1ef5dbe5 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c,v 3.2 1999/11/19 13:54:14 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c,v 3.3 2000/08/11 17:27:12 dawes Exp $ */ /* * (c) Copyright 1993,1994 by Dirk Hohndel <hohndel@xfree86.org> * @@ -30,11 +30,7 @@ #define PCI_EN 0x80000000 -#ifdef PC98 -static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 }; -#else static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; -#endif #define NUMPORTS (sizeof(Ports)/sizeof(Word)) diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c index 6a8525871..0315ac8f1 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.8 1999/03/14 03:21:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.9 2000/08/11 17:27:12 dawes Exp $ */ /* * (c) Copyright 1993,1994 by Robin Cutshaw <robin@xfree86.org> * @@ -30,11 +30,7 @@ #include "Probe.h" -#ifdef PC98 -static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 }; -#else static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; -#endif #define NUMPORTS (sizeof(Ports)/sizeof(Word)) diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile index aa2582a99..a4e03d54e 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/14 1996/10/27 11:03:56 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.35 2000/02/12 20:45:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.36 2000/08/10 17:40:33 dawes Exp $ #if (defined(SVR3Architecture) || defined(SVR4Architecture) || defined(SCOArchitecture)) && !defined(DguxArchitecture) # define OSModule OS_SYSV @@ -69,6 +69,11 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.35 2000/ # define OSModule OS_Mach #endif #endif + +#if defined(cygwinArchitecture) +#define OSModule OS_cygwin +#endif + #if defined(OS2Architecture) # define OSModule OS_Os2 CCOPTIONS = -Zmts diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c index 9551542da..3698049af 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c,v 3.13 1999/03/28 15:32:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c,v 3.14 2000/08/01 23:38:47 dawes Exp $ */ /* * (c) Copyright 1993,1994 by Orest Zborowski <orestz@eskimo.com> * @@ -112,7 +112,11 @@ int OpenVideo() } close(fd); sprintf(fn, "/dev/tty%d", VT_num); - if ((VT_fd = open(fn, O_RDWR|O_NDELAY, 0)) < 0) + if ((VT_fd = open(fn, O_RDWR|O_NDELAY, 0)) < 0) { + sprintf(fn, "/dev/vc/%d", VT_num); + VT_fd = open(fn, O_RDWR|O_NDELAY, 0); + } + if (VT_fd < 0) { fprintf(stderr, "%s: Could not open VT %s\n", MyName, fn); return(-1); diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c index 8adae61a6..6bd90dcc2 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c @@ -7,7 +7,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c,v 3.9 1999/03/14 03:21:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c,v 3.10 2000/08/11 17:27:12 dawes Exp $ */ /* #define DEBUGPCI */ @@ -23,11 +23,7 @@ xf86scanpci() unsigned int i, j, idx = 0; int func; struct pci_config_reg pcr; -#ifdef PC98 - Word PCI_CtrlIOPorts[] = { 0xCF8, 0xCF9, 0xCFC }; -#else Word PCI_CtrlIOPorts[] = { 0xCF8, 0xCFA, 0xCFC }; -#endif int Num_PCI_CtrlIOPorts = 3; unsigned PCI_DevIOAddrPorts[16*16]; int Num_PCI_DevIOAddrPorts = 16*16; diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c index a73b10363..ebc2c5ada 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c,v 3.2 1999/11/19 13:54:16 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c,v 3.3 2000/08/11 17:27:12 dawes Exp $ */ /* * (c) Copyright 1997 by Dirk Hohndel <hohndel@xfree86.org> * @@ -30,11 +30,7 @@ #define PCI_EN 0x80000000 -#ifdef PC98 -static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 }; -#else static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; -#endif #define NUMPORTS (sizeof(Ports)/sizeof(Word)) diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index 5801b594f..f00fb4343 100644 --- a/xc/programs/Xserver/hw/xfree86/common/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.117 2000/06/30 17:15:10 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.120 2000/08/11 19:51:01 dawes Exp $ @@ -160,7 +160,13 @@ OFILES = \ OSNAME = OSName OSVENDOR = OSVendor - OSNAMEDEF = -DOSNAME='"$(OSNAME)"' -DOSVENDOR='"$(OSVENDOR)"' + OSNAMEDEF = -DOSNAME='" $(OSNAME)"' -DOSVENDOR='" $(OSVENDOR)"' +#if defined(BuilderString) + BUILDERSTRING = BuilderString + BUILDERMSG = -DBUILDERSTRING='$(BUILDERSTRING)' +#else + BUILDERMSG = +#endif CONSDEFINES = XFree86ConsoleDefines EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES) PROJECTROOT = ProjectRoot @@ -170,16 +176,12 @@ XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \ -DDRIVERS='"$(DRIVERS)"' \ -DIDRIVERS='"$(IDRIVERS)"' -#if defined(SunArchitecture) && defined(SVR4Architecture) && OSMinorVersion >= 8 - OSDEFINES = -DSOL8 -#endif - DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OSDEFINES) AllTarget($(OFILES)) -SpecialCObjectRule(xf86Bus,NullParameter,$(VGAINCLUDES)) -SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(EXT_DEFINES) $(BETADEFS)) +SpecialCObjectRule(xf86Bus,NullParameter,$(BUGMSG) $(VGAINCLUDES)) +SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(EXT_DEFINES) $(BETADEFS)) SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES) $(MODPATHDEFINES) $(LOGDEFINES)) SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES)) diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h index 747fb5b57..134136122 100644 --- a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h +++ b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.13 2000/02/09 22:00:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.15 2000/08/11 23:59:48 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -69,8 +69,6 @@ * ---------------- ---------- ------- ------ ------ */ -#ifndef PC98 - #define KEY_Escape /* Escape 0x01 */ 1 #define KEY_1 /* 1 ! 0x02 */ 2 #define KEY_2 /* 2 @ 0x03 */ 3 @@ -195,116 +193,8 @@ #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#else - -#define KEY_Escape /* Escape 0x01 */ 0 -#define KEY_1 /* 1 ! 0x02 */ 1 -#define KEY_2 /* 2 " 0x03 */ 2 -#define KEY_3 /* 3 # 0x04 */ 3 -#define KEY_4 /* 4 $ 0x05 */ 4 -#define KEY_5 /* 5 % 0x06 */ 5 -#define KEY_6 /* 6 & 0x07 */ 6 -#define KEY_7 /* 7 ' 0x08 */ 7 -#define KEY_8 /* 8 ( 0x09 */ 8 -#define KEY_9 /* 9 ) 0x0a */ 9 -#define KEY_0 /* 0 0x0b */ 10 -#define KEY_Minus /* - (Minus) = (Equal) 0x0c */ 11 -#define KEY_Hat /* ^ (Hat) ` 0x0d */ 12 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_At /* @ ~ 0x1a */ 26 -#define KEY_LBrace /* [ { 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_A /* A 0x1d */ 29 -#define KEY_S /* S 0x1e */ 30 -#define KEY_D /* D 0x1f */ 31 -#define KEY_F /* F 0x20 */ 32 -#define KEY_G /* G 0x21 */ 33 -#define KEY_H /* H 0x22 */ 34 -#define KEY_J /* J 0x23 */ 35 -#define KEY_K /* K 0x24 */ 36 -#define KEY_L /* L 0x25 */ 37 -#define KEY_SemiColon /* ;(SemiColon) +(Plus) 0x26 */ 38 -#define KEY_Colon /* :(Colon) *(Quote) 0x27 */ 39 -#define KEY_RBrace /* ] } 0x28 */ 40 -#define KEY_Z /* Z 0x29 */ 41 -#define KEY_X /* X 0x2a */ 42 -#define KEY_C /* C 0x2b */ 43 -#define KEY_V /* V 0x2c */ 44 -#define KEY_B /* B 0x2d */ 45 -#define KEY_N /* N 0x2e */ 46 -#define KEY_M /* M 0x2f */ 47 -#define KEY_Comma /* , (Comma) < (Less) 0x30 */ 48 -#define KEY_Period /* . (Period) >(Greater)0x31 */ 49 -#define KEY_Slash /* / (Slash) ? 0x32 */ 50 -#define KEY_Under /* _ 0x33 */ 51 -#define KEY_Space /* (SpaceBar) 0x34 */ 52 -#define KEY_Xfer /* (XFER) 0x35 */ 53 -#define KEY_PgUp /* PgUp 0x36 */ 54 -#define KEY_Pgdown /* (Roll Down) 0x37 */ 55 -#define KEY_Insert /* Insert 0x38 */ 56 -#define KEY_Delete /* Delete 0x39 */ 57 -#define KEY_Up /* Up 0x3a */ 58 -#define KEY_Left /* Left 0x3b */ 59 -#define KEY_Right /* Right 0x3c */ 60 -#define KEY_Down /* Down 0x3d */ 61 -#define KEY_Home /* Home 0x3e */ 62 -#define KEY_Help /* Help 0x3f */ 63 -#define KEY_KP_Subtract /* - (Minus) 0x40 */ 64 -#define KEY_KP_Minus /* - */ 64 -#define KEY_KP_Divide /* / (Slash) 0x41 */ 65 -#define KEY_KP_7 /* 7 0x42 */ 66 -#define KEY_KP_8 /* 8 0x43 */ 67 -#define KEY_KP_9 /* 9 0x44 */ 68 -#define KEY_KP_Multiply /* * 0x45 */ 69 -#define KEY_KP_4 /* 4 0x46 */ 70 -#define KEY_KP_5 /* 5 0x47 */ 71 -#define KEY_KP_6 /* 6 0x48 */ 72 -#define KEY_KP_Add /* + (Plus) 0x49 */ 73 -#define KEY_KP_Plus /* + */ 73 -#define KEY_KP_1 /* 1 0x4a */ 74 -#define KEY_KP_2 /* 2 0x4b */ 75 -#define KEY_KP_3 /* 3 0x4c */ 76 -#define KEY_KP_Equal /* = 0x4d */ 77 -#define KEY_KP_0 /* 0 0x4e */ 78 -#define KEY_KP_Separator /* , 0x4f */ 79 -#define KEY_KP_Decimal /* . (Decimal) 0x50 */ 80 -#define KEY_Nfer /* (NFER) 0x51 */ 81 -#define KEY_F11 /* F11 0x52 */ 82 -#define KEY_F12 /* F12 0x53 */ 83 -#define KEY_F13 /* F13 0x54 */ 84 -#define KEY_F14 /* F14 0x55 */ 85 -#define KEY_F15 /* F15 0x56 */ 86 -#define KEY_Break /* (Stop) 0x60 */ 96 -#define KEY_Copy /* (Copy) 0x61 */ 97 -#define KEY_Begin /* Begin ?? */ 97 -#define KEY_F1 /* F1 0x62 */ 98 -#define KEY_F2 /* F2 0x63 */ 99 -#define KEY_F3 /* F3 0x64 */ 100 -#define KEY_F4 /* F4 0x65 */ 101 -#define KEY_F5 /* F5 0x66 */ 102 -#define KEY_F6 /* F6 0x67 */ 103 -#define KEY_F7 /* F7 0x68 */ 104 -#define KEY_F8 /* F8 0x69 */ 105 -#define KEY_F9 /* F9 0x6a */ 106 -#define KEY_F10 /* F10 0x6b */ 107 -#define KEY_ShiftL /* Shift(left) 0x70 */ 112 -#define KEY_CapsLock /* CapsLock 0x71 */ 113 -#define KEY_KanaLock /* Kana 0x72 */ 114 -#define KEY_Alt /* Alt(left) 0x73 */ 115 -#define KEY_LCtrl /* Ctrl(left) 0x74 */ 116 - -#endif /* PC98 */ +/* These are for "notused" and "uknown" entries in translation maps. */ +#define KEY_NOTUSED 0 +#define KEY_UNKNOWN 255 #endif /* _ATKEYNAMES_H */ diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h index b8d8123a4..1b177aaf8 100644 --- a/xc/programs/Xserver/hw/xfree86/common/compiler.h +++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.62 2000/06/25 12:35:53 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.65 2000/08/11 17:27:13 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -24,6 +24,11 @@ /* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */ #ifndef _COMPILER_H + +#if !defined(_XF86_ANSIC_H) && defined(XFree86Module) +# error missing #include "xf86_ansic.h" before #include "compiler.h" +#endif + #define _COMPILER_H #ifndef __STDC__ @@ -40,14 +45,8 @@ # ifdef __GNUC__ # define volatile __volatile__ # define const __const__ -# ifdef PC98 -# undef NO_INLINE -# endif # else # define const /**/ -# ifdef PC98 -# define __inline__ /**/ -# endif # ifdef __HIGHC__ # define __inline__ _Inline # endif @@ -546,7 +545,7 @@ outw(unsigned short port, unsigned short val) static __inline__ void outl(unsigned short port, unsigned int val) { - *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val; + *(volatile unsigned int*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ unsigned int @@ -564,7 +563,7 @@ inw(unsigned short port) static __inline__ unsigned int inl(unsigned short port) { - return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase)); + return(*(volatile unsigned int*)(((unsigned short)(port))+IOPortBase)); } @@ -705,7 +704,7 @@ xf86ReadMmio32Le(void *base, const unsigned long offset) static __inline__ void xf86WriteMmioNB8(void *base, const unsigned long offset, - const unsigned int val) + const unsigned char val) { __asm__ __volatile__( "stbx %1,%2,%3\n\t" @@ -715,7 +714,7 @@ xf86WriteMmioNB8(void *base, const unsigned long offset, static __inline__ void xf86WriteMmioNB16Le(void *base, const unsigned long offset, - const unsigned int val) + const unsigned short val) { __asm__ __volatile__( "sthbrx %1,%2,%3\n\t" @@ -725,7 +724,7 @@ xf86WriteMmioNB16Le(void *base, const unsigned long offset, static __inline__ void xf86WriteMmioNB16Be(void *base, const unsigned long offset, - const unsigned int val) + const unsigned short val) { __asm__ __volatile__( "sthx %1,%2,%3\n\t" @@ -735,7 +734,7 @@ xf86WriteMmioNB16Be(void *base, const unsigned long offset, static __inline__ void xf86WriteMmioNB32Le(void *base, const unsigned long offset, - const unsigned long val) + const unsigned int val) { __asm__ __volatile__( "stwbrx %1,%2,%3\n\t" @@ -745,7 +744,7 @@ xf86WriteMmioNB32Le(void *base, const unsigned long offset, static __inline__ void xf86WriteMmioNB32Be(void *base, const unsigned long offset, - const unsigned long val) + const unsigned int val) { __asm__ __volatile__( "stwx %1,%2,%3\n\t" @@ -755,7 +754,7 @@ xf86WriteMmioNB32Be(void *base, const unsigned long offset, static __inline__ void xf86WriteMmio8(void *base, const unsigned long offset, - const unsigned int val) + const unsigned char val) { xf86WriteMmioNB8(base,offset,val); eieio(); @@ -763,7 +762,7 @@ xf86WriteMmio8(void *base, const unsigned long offset, static __inline__ void xf86WriteMmio16Le(void *base, const unsigned long offset, - const unsigned int val) + const unsigned short val) { xf86WriteMmioNB16Le(base,offset,val); eieio(); @@ -771,7 +770,7 @@ xf86WriteMmio16Le(void *base, const unsigned long offset, static __inline__ void xf86WriteMmio16Be(void *base, const unsigned long offset, - const unsigned int val) + const unsigned short val) { xf86WriteMmioNB16Be(base,offset,val); eieio(); @@ -779,7 +778,7 @@ xf86WriteMmio16Be(void *base, const unsigned long offset, static __inline__ void xf86WriteMmio32Le(void *base, const unsigned long offset, - const unsigned long val) + const unsigned int val) { xf86WriteMmioNB32Le(base,offset,val); eieio(); @@ -787,7 +786,7 @@ xf86WriteMmio32Le(void *base, const unsigned long offset, static __inline__ void xf86WriteMmio32Be(void *base, const unsigned long offset, - const unsigned long val) + const unsigned int val) { xf86WriteMmioNB32Be(base,offset,val); eieio(); @@ -873,7 +872,6 @@ inl(unsigned short port) * If gcc uses gas rather than the native assembler, the syntax of these * inlines has to be different. DHD */ -#ifndef PC98 static __inline__ void outb(unsigned short port, unsigned char val) @@ -924,245 +922,6 @@ inl(unsigned short port) return ret; } -#else /* PC98 */ - -static __inline__ void -_outb(unsigned short port, unsigned char val) -{ - __asm__ __volatile__("outb %0,%1" ::"a" (val), "d" (port)); -} - -static __inline__ void -_outw(unsigned short port, unsigned short val) -{ - __asm__ __volatile__("outw %0,%1" ::"a" (val), "d" (port)); -} - -static __inline__ void -_outl(unsigned short port, unsigned int val) -{ - __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); -} - - -static __inline__ unsigned int -_inb(unsigned short port) -{ - unsigned char ret; - __asm__ __volatile__("inb %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -_inw(unsigned short port) -{ - unsigned char ret; - __asm__ __volatile__("inw %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -_inl(unsigned short port) -{ - unsigned int ret; - __asm__ __volatile__("inl %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - - -#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968) -#define PW_PORT 0x600 -extern short chipID; -extern void *mmioBase; -extern unsigned short _port_tbl[]; -#define port_convert(x) _port_tbl[(unsigned short)x] -#endif - -#if defined(PC98_WAB) || defined(PC98_GANB_WAP) -static __inline__ unsigned short -port_convert(unsigned short port) -{ - port <<= 8; - port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ - port |= 0xE0; - return port; -} -#endif /* PC98_WAB || PC98_GANB_WAP */ - -#if defined(PC98_WABEP) -static __inline__ unsigned short -port_convert(unsigned short port) -{ - port &= 0x7f; /* Mask 0000 0000 0111 1111 */ - port |= 0x0f00; - return port; -} -#endif /* PC98_WABEP */ - -#ifdef PC98_WSNA -static __inline__ unsigned short -port_convert(unsigned short port) -{ - port <<= 8; - port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ - port |= 0xE2; - return port; -} -#endif /* PC98_WSNA */ - -#ifdef PC98_NKVNEC -#ifdef PC98_NEC_CIRRUS2 -static __inline__ unsigned short -port_convert(unsigned short port) -{ - port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050; - return port; -} -#else -static __inline__ unsigned short -port_convert(unsigned short port) -{ - port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0; - return port; -} -#endif /* PC98_NEC_CIRRUS2 */ -#endif /* PC98_NKVNEC */ - -#if defined(PC98_TGUI) -extern void *mmioBase; -#endif - -static __inline__ void -outb(unsigned short port, unsigned char val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val); -#else - __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); -#endif -} - -static __inline__ void -outw(unsigned short port, unsigned short val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val); -#else - __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); -#endif -} - -static __inline__ void -outl(unsigned short port, unsigned int val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val); -#else - __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); -#endif -} - -static __inline__ unsigned int -inb(unsigned short port) -{ - unsigned char ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - ret =*(volatile unsigned char *)((char *)mmioBase+(port)); -#else - __asm__ __volatile__("inb %1,%0" : - "=a" (ret) : - "d" (port)); -#endif - return ret; -} - -static __inline__ unsigned int -inw(unsigned short port) -{ - unsigned short ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - ret =*(volatile unsigned short *)((char *)mmioBase+(port)); -#else - __asm__ __volatile__("inw %1,%0" : - "=a" (ret) : - "d" (port)); -#endif - return ret; -} - -static __inline__ unsigned int -inl(unsigned short port) -{ - unsigned int ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI) - ret =*(volatile unsigned int *)((char *)mmioBase+(port)); -#else - __asm__ __volatile__("inl %1,%0" : - "=a" (ret) : - "d" (port)); -#endif - return ret; -} - -#endif /* PC98 */ - #else /* GCCUSESGAS */ static __inline__ void @@ -1300,10 +1059,10 @@ extern volatile unsigned char *ioBase; extern void debug_outb(unsigned int a, unsigned char b, int line, char *file); extern void debug_outw(unsigned int a, unsigned short w, int line, char *file); -extern void debug_outl(unsigned int a, unsigned long l, int line, char *file); +extern void debug_outl(unsigned int a, unsigned int l, int line, char *file); extern unsigned char debug_inb(unsigned int a, int line, char *file); extern unsigned short debug_inw(unsigned int a, int line, char *file); -extern unsigned long debug_inl(unsigned int a, int line, char *file); +extern unsigned int debug_inl(unsigned int a, int line, char *file); #define outb(a,b) debug_outb(a,b, __LINE__, __FILE__) #define outw(a,w) debug_outw(a,w, __LINE__, __FILE__) @@ -1316,7 +1075,7 @@ extern unsigned long debug_inl(unsigned int a, int line, char *file); extern unsigned char inb(unsigned int a); extern unsigned short inw(unsigned int a); -extern unsigned long inl(unsigned int a); +extern unsigned int inl(unsigned int a); # if PPCIO_INLINE @@ -1327,8 +1086,8 @@ extern unsigned long inl(unsigned int a); # else /* !PPCIO_INLINE */ extern void outb(unsigned int a, unsigned char b); -extern void outw(unsigned int a, unsigned char w); -extern void outl(unsigned int a, unsigned char l); +extern void outw(unsigned int a, unsigned short w); +extern void outl(unsigned int a, unsigned int l); # endif /* PPCIO_INLINE */ @@ -1351,7 +1110,6 @@ extern void outl(unsigned int a, unsigned char l); # endif # endif # endif -# ifndef PC98 # ifndef SCO325 # if defined(USL) # if defined(IN_MODULE) @@ -1370,278 +1128,7 @@ extern void outl(unsigned int a, unsigned char l); # else # include "scoasm.h" # endif -# else -#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968) -#define PW_PORT 0x600 -extern short chipID; -extern void *mmioBase; -extern unsigned short _port_tbl[]; -#define port_convert(x) _port_tbl[(unsigned short)x] -#endif - -asm void _outl(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outl (%dx) -%reg port; mem val; - movl port, %edx - movl val, %eax - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outl (%dx) -%mem port,val; - movw port, %dx - movl val, %eax - outl (%dx) -} - -asm void _outw(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - data16 - outl (%dx) -%reg port; mem val; - movl port, %edx - movw val, %ax - data16 - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - data16 - outl (%dx) -%mem port,val; - movw port, %dx - movw val, %ax - data16 - outl (%dx) -} - -asm void _outb(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outb (%dx) -%reg port; mem val; - movl port, %edx - movb val, %al - outb (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outb (%dx) -%mem port,val; - movw port, %dx - movb val, %al - outb (%dx) -} - -asm int _inl(port) -{ -%reg port; - movl port, %edx - inl (%dx) -%mem port; - movw port, %dx - inl (%dx) -} - -asm int _inw(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - data16 - inl (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - data16 - inl (%dx) -} - -asm int _inb(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - inb (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - inb (%dx) -} - -#if defined(PC98_WAB) || defined(PC98_GANB_WAP) -static unsigned short -port_convert(unsigned short port) -{ - port <<= 8; - port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ - port |= 0xE0; - return port; -} -#endif /* PC98_WAB || PC98_GANB_WAP */ - -#if defined(PC98_WABEP) -static unsigned short -port_convert(unsigned short port) -{ - port &= 0x7f; /* Mask 0000 0000 0111 1111 */ - port |= 0x0f00; - return port; -} -#endif /* PC98_WABEP */ - -#ifdef PC98_WSNA -static unsigned short -port_convert(unsigned short port) -{ - port <<= 8; - port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ - port |= 0xE2; - return port; -} -#endif /* PC98_WSNA */ - -#ifdef PC98_NKVNEC -#ifdef PC98_NEC_CIRRUS2 -static unsigned short -port_convert(unsigned short port) -{ - port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050; - return port; -} -#else -static unsigned short -port_convert(unsigned short port) -{ - port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0; - return port; -} -#endif /* PC98_NEC_CIRRUS2 */ -#endif /* PC98_NKVNEC */ - -static void outl(port,val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val); -#else - _outl(port,val); -#endif -} - -static void outw(port,val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val); -#else - _outw(port,val); -#endif -} - -static void outb(port,val) -{ -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val); -#else - _outb(port,val); -#endif -} - -static int inl(port) -{ - unsigned int ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - ret =*(volatile unsigned int *)((char *)mmioBase+(port)); -#else - ret = _inl(port); -#endif - return ret; -} - -static int inw(port) -{ - unsigned short ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - ret =*(volatile unsigned short *)((char *)mmioBase+(port)); -#else - ret = _inw(port); -#endif - return ret; -} - -static int inb(port) -{ - unsigned char ret; - -#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ - defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ - defined(PC98_XKB) || defined(PC98_NEC) - unsigned short tmp; - tmp=port_convert(port); - port=tmp; -#endif - -#if defined(PC98_NEC)||defined(PC98_PWLB) - ret =*(volatile unsigned char *)((char *)mmioBase+(port)); -#else - ret = _inb(port); -#endif - return ret; -} - -# endif /* PC98 */ # if !defined(__HIGHC__) && !defined(SCO325) # pragma asm partial_optimization outl # pragma asm partial_optimization outw @@ -1691,7 +1178,7 @@ extern void outl(unsigned port, unsigned val); #undef outl #define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) #define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) -#define inl(a) __extension__ ({unsigned long __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) +#define inl(a) __extension__ ({unsigned int __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) #define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b)) #define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b)) diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index aed451cc2..80bb4236e 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.140 2000/06/20 05:08:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.141 2000/08/04 21:07:11 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -223,6 +223,7 @@ void xf86GetClocks(ScrnInfoPtr pScrn, int num, void (*ProtectRegs)(ScrnInfoPtr, Bool), void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, int maskval, int knownclkindex, int knownclkvalue); +void xf86SetPriority(Bool up); const char *xf86GetVisualName(int visual); int xf86GetVerbosity(void); Pix24Flags xf86GetPix24(void); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c index d4e514b78..b717c2f3b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.52 2000/06/30 17:15:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.53 2000/08/04 16:13:24 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -879,9 +879,14 @@ checkConflictBlock(resRange *range, resPtr pRes) switch (pRes->res_type & ResExtMask) { case ResBlock: if (range->rBegin < pRes->block_end && - range->rEnd > pRes->block_begin) + range->rEnd > pRes->block_begin) { +#ifdef DEBUG + ErrorF("b-b conflict w: %lx %lx\n", + pRes->block_begin,pRes->block_end); +#endif return pRes->block_end < range->rEnd ? - pRes->block_end : range->rEnd; + pRes->block_end : range->rEnd; + } return 0; case ResSparse: if (pRes->sparse_base > range->rEnd) return 0; @@ -906,6 +911,8 @@ checkConflictBlock(resRange *range, resPtr pRes) if (tmp >= range->rBegin) { #ifdef DEBUG ErrorF("conflict found at: 0x%lx\n",tmp); + ErrorF("b-d conflict w: %lx %lx\n", + pRes->sparse_base,pRes->sparse_mask); #endif return tmp; } @@ -930,8 +937,13 @@ checkConflictSparse(resRange *range, resPtr pRes) switch (pRes->res_type & ResExtMask) { case ResSparse: tmp = pRes->sparse_mask & range->rMask; - if ((tmp & pRes->sparse_base) == (tmp & range->rBase)) + if ((tmp & pRes->sparse_base) == (tmp & range->rBase)) { +#ifdef DEBUG + ErrorF("s-b conflict w: %lx %lx\n", + pRes->sparse_base,pRes->sparse_mask); +#endif return pRes->sparse_mask; + } return 0; case ResBlock: @@ -973,6 +985,8 @@ checkConflictSparse(resRange *range, resPtr pRes) } #ifdef DEBUG ErrorF("conflict found at: 0x%lx\n",tmp); + ErrorF("b-b conflict w: %lx %lx\n", + pRes->block_begin,pRes->block_end); #endif return ~m_mask; } @@ -1277,13 +1291,13 @@ xf86PrintResList(int verb, resPtr list) xf86ErrorFVerb(verb, "%s", s); switch (list->res_type & ResExtMask) { case ResBlock: - s = "B"; + s = "[B]"; break; case ResSparse: - s = "S"; + s = "[S]"; break; default: - s = "?"; + s = "[?]"; } xf86ErrorFVerb(verb, "%s", s); if (list->res_type & ResEstimated) @@ -2206,12 +2220,12 @@ resError(resList list) { FatalError("A driver tried to allocate the %s %sresource at \n" "0x%x:0x%x which conflicted with another resource. Send the\n" - "output of the server to xfree86@xfree86.org. Please \n" + "output of the server to %s. Please \n" "specify your computer hardware as closely as possible.\n", ResIsBlock(list)?"Block":"Sparse", ResIsMem(list)?"Mem":"Io", ResIsBlock(list)?list->rBegin:list->rBase, - ResIsBlock(list)?list->rEnd:list->rMask); + ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR); } /* @@ -2914,6 +2928,33 @@ xf86FindPrimaryDevice() /* if no VGA device is found check for primary PCI device */ if (primaryBus.type == BUS_NONE) CheckGenericGA(); + if (primaryBus.type != BUS_NONE) { + char *bus; + char *loc = xnfcalloc(1,8); + + switch (primaryBus.type) { + case BUS_PCI: + bus = "PCI"; + sprintf(loc,"%2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, + primaryBus.id.pci.device,primaryBus.id.pci.func); + break; + case BUS_ISA: + bus = "ISA"; + loc = ""; + break; + case BUS_SBUS: + bus = "SBUS"; + sprintf(loc,"%2.2",primaryBus.id.sbus.fbNum); + break; + default: + bus = ""; + loc = ""; + } + + xf86MsgVerb(X_INFO, 2, "Primary Device is: %s %s\n",bus,loc); + xfree(loc); + } + } #include "vgaHW.h" diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c index fcfc40bf7..e2111f4a8 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.226 2000/06/20 05:08:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.228 2000/08/11 19:51:02 dawes Exp $ */ /* @@ -941,7 +941,7 @@ configInputKbd(IDevPtr inputp) #ifdef XKB if (!xf86IsPc98()) { xf86Info.xkbrules = "xfree86"; -#ifdef SOL8 +#ifdef __SOL8__ xf86Info.xkbmodel = "pc101_sol8x86"; #else xf86Info.xkbmodel = "pc101"; @@ -969,7 +969,7 @@ configInputKbd(IDevPtr inputp) s = xf86SetStrOption(inputp->commonOptions, "Protocol", "standard"); if (xf86NameCmp(s, "standard") == 0) { xf86Info.kbdProc = xf86KbdProc; -#ifdef AMOEBA +#if defined(AMOEBA) || defined(__CYGWIN__) xf86Info.kbdEvents = NULL; #else xf86Info.kbdEvents = xf86KbdEvents; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c index 3c72e503d..2edf501fc 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.39 2000/06/23 11:01:51 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.40 2000/08/04 16:13:24 eich Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -725,17 +725,22 @@ DoConfigure() } xf86DoConfigurePass1 = FALSE; + + { + Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool)); + for (screennum = 0; screennum < nDevToConfig; screennum++) { + i = DevToConfig[screennum].iDriver; + + if (driverProbed[i]) continue; + driverProbed[i] = TRUE; - i = -1; - for (screennum = 0; screennum < nDevToConfig; screennum++) { - if (i == DevToConfig[screennum].iDriver) continue; - - i = DevToConfig[screennum].iDriver; - - (*xf86DriverList[i]->Probe)(xf86DriverList[i], 0); + (*xf86DriverList[i]->Probe)(xf86DriverList[i], 0); - xf86SetPciVideo(NULL,NONE); + xf86SetPciVideo(NULL,NONE); + } + xfree(driverProbed); } + if (nDevToConfig != xf86NumScreens) { ErrorF("Number of created screens does not match number of detected" diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index ea6d47781..6df1e19d4 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.94 2000/05/18 23:21:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.97 2000/08/11 19:51:03 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -296,7 +296,7 @@ ProcessInputEvents () extern u_char SpecialServerMap[]; #endif /* ASSUME_CUSTOM_KEYCODES */ -#if !defined(__EMX__) && !defined(SOL8) +#if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__) void xf86PostKbdEvent(unsigned key) { @@ -339,7 +339,7 @@ xf86PostKbdEvent(unsigned key) goto special; #endif /* __sparc__ */ -#if defined (i386) && defined (SVR4) && !defined (PC98) +#if defined (i386) && defined (SVR4) /* * PANIX returns DICOP standards based keycodes in using 106jp * keyboard. We need to remap some keys. @@ -374,8 +374,6 @@ xf86PostKbdEvent(unsigned key) if (xf86Info.scanPrefix == 0) { switch (scanCode) { - -#ifndef PC98 case KEY_Prefix0: case KEY_Prefix1: #if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) @@ -388,11 +386,9 @@ xf86PostKbdEvent(unsigned key) } break; #endif -#endif /* not PC98 */ } } -#ifndef PC98 else if ( #ifdef CSRG_BASED (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS @@ -458,7 +454,6 @@ xf86PostKbdEvent(unsigned key) if (scanCode != KEY_NumLock) return; scanCode = KEY_Pause; /* pause */ } -#endif /* not PC98 */ #endif /* !ASSUME_CUSTOM_KEYCODES */ /* @@ -471,6 +466,27 @@ xf86PostKbdEvent(unsigned key) specialkey = scanCode; #endif /* ASSUME_CUSTOM_KEYCODES */ + if (xf86IsPc98()) { + switch (scanCode) { + case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ + case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ + case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ + case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ + case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ + case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ + case 0x65: specialkey = 0x3e; break; /* KEY_F4 */ + case 0x66: specialkey = 0x3f; break; /* KEY_F5 */ + case 0x67: specialkey = 0x40; break; /* KEY_F6 */ + case 0x68: specialkey = 0x41; break; /* KEY_F7 */ + case 0x69: specialkey = 0x42; break; /* KEY_F8 */ + case 0x6a: specialkey = 0x43; break; /* KEY_F9 */ + case 0x6b: specialkey = 0x44; break; /* KEY_F10 */ + /* case 0x73: specialkey = 0x38; break; KEY_Alt */ + /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */ + default: specialkey = 0x00; break; + } + } + #if defined (__sparc__) special: if (kbdSun) { @@ -704,17 +720,13 @@ special: /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ case KEY_Alt: -#ifndef PC98 case KEY_AltLang: -#endif /* not PC98 */ break; -#ifndef PC98 case KEY_SysReqest: if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask))) VTSysreqToggle = TRUE; break; -#endif /* not PC98 */ default: if (VTSysreqToggle) @@ -822,7 +834,6 @@ special: * ignore releases, toggle on & off on presses. * Don't deal with the Caps_Lock keysym directly, but check the lock modifier */ -#ifndef PC98 if (keyc->modifierMap[keycode] & LockMask || keysym[0] == XK_Scroll_Lock || keysym[1] == XF86XK_ModeLock || @@ -844,14 +855,13 @@ special: if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag; updateLeds = TRUE; } -#endif /* not PC98 */ #ifndef ASSUME_CUSTOM_KEYCODES /* * normal, non-keypad keys */ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) +#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) && !defined(__CYGWIN__) /* * magic ALT_L key on AT84 keyboards for multilingual support */ @@ -918,7 +928,7 @@ special: void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { -#if !defined(__EMX__) && !defined(__QNX__) +#if !defined(__EMX__) && !defined(__QNX__) && !defined(__CYGWIN__) #ifdef __OSF__ fd_set kbdDevices; fd_set mseDevices; @@ -1110,7 +1120,7 @@ xf86VTSwitch() for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->LeaveVT(i, 0); } -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { @@ -1146,7 +1156,7 @@ xf86VTSwitch() } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { @@ -1196,7 +1206,7 @@ xf86VTSwitch() /* Turn screen saver off when switching back */ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c index 0420671b6..e2c85f0e7 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.94 2000/06/20 05:08:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.95 2000/08/04 21:07:11 tsi Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -2053,14 +2053,7 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), /* First save registers that get written on */ (*ClockFunc)(pScrn, CLK_REG_SAVE); -#if defined(CSRG_BASED) || defined(MACH386) - saved_nice = getpriority(PRIO_PROCESS, 0); - setpriority(PRIO_PROCESS, 0, -20); -#endif -#if defined(SYSV) || defined(SVR4) || defined(linux) - saved_nice = nice(0); - nice(-20 - saved_nice); -#endif + xf86SetPriority(TRUE); if (num > MAXCLOCKS) num = MAXCLOCKS; @@ -2119,12 +2112,7 @@ finish: (*BlankScreen)(pScrn, TRUE); } -#if defined(CSRG_BASED) || defined(MACH386) - setpriority(PRIO_PROCESS, 0, saved_nice); -#endif -#if defined(SYSV) || defined(SVR4) || defined(linux) - nice(20 + saved_nice); -#endif + xf86SetPriority(FALSE); for (i = 0; i < num; i++) { @@ -2153,6 +2141,31 @@ finish: /* Restore registers that were written on */ (*ClockFunc)(pScrn, CLK_REG_RESTORE); } + +void +xf86SetPriority(Bool up) +{ + static int saved_nice; + + if (up) { +#if defined(CSRG_BASED) || defined(MACH386) + saved_nice = getpriority(PRIO_PROCESS, 0); + setpriority(PRIO_PROCESS, 0, -20); +#endif +#if defined(SYSV) || defined(SVR4) || defined(linux) + saved_nice = nice(0); + nice(-20 - saved_nice); +#endif + } else { +#if defined(CSRG_BASED) || defined(MACH386) + setpriority(PRIO_PROCESS, 0, saved_nice); +#endif +#if defined(SYSV) || defined(SVR4) || defined(linux) + nice(20 + saved_nice); +#endif + } +} + const char * xf86GetVisualName(int visual) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c index d32025181..d62ce55f2 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.162 2000/06/25 20:17:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.164 2000/08/04 16:13:24 eich Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -725,7 +725,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) * serverGeneration != 1; some OSs have to do things here, too. */ xf86OpenConsole(); - xf86OSPMClose = xf86OSPMOpen(); + + if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) + xf86MsgVerb(3,X_INFO,"APM registered successfully\n"); /* Make sure full I/O access is enabled */ xf86EnableIO(); @@ -1101,6 +1103,7 @@ OsVendorFatalError() "the full server output, not just the last messages.\n"); if (xf86LogFile) ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile); + ErrorF("Please reports problems to %s.\n",BUILDERADDR); ErrorF("\n"); } @@ -1517,7 +1520,7 @@ ddxUseMsg() #ifndef OSNAME -#define OSNAME "unknown" +#define OSNAME " unknown" #endif #ifndef OSVENDOR #define OSVENDOR "" @@ -1535,7 +1538,10 @@ xf86PrintBanner() "\tthan the above date, look for a newer version before " "reporting\n" "\tproblems. (see http://www.XFree86.Org/FAQ)\n"); - ErrorF("Operating System: %s %s\n", OSNAME, OSVENDOR); + ErrorF("Operating System:%s%s\n", OSNAME, OSVENDOR); +#if defined(BUILDERSTRING) + ErrorF("%s \n",BUILDERSTRING); +#endif #ifdef XFree86LOADER ErrorF("Module Loader present\n"); #endif diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c index 5b672981c..d8642b65b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.39 2000/06/13 02:28:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.40 2000/08/10 17:40:34 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -369,7 +369,7 @@ xf86KbdProc (pKeyboard, what) read(kbdFd, buf, 16); } -#ifndef __EMX__ /* Under EMX, keyboard cannot be select()'ed */ +#if !defined(__EMX__) && !defined(__CYGWIN__) /* Under EMX, keyboard cannot be select()'ed */ if (kbdFd != -1) AddEnabledDevice(kbdFd); #endif /* __EMX__ */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c index a1619b0c4..375cf8391 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.13 2000/06/23 22:42:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.14 2000/08/11 17:27:13 dawes Exp $ */ /* * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -40,7 +40,6 @@ #define KD_GET_ENTRY(i,n) \ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] -#ifndef PC98 static unsigned char remap[128] = { 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ @@ -59,27 +58,6 @@ static unsigned char remap[128] = { 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ }; -#else /* PC98 */ -static unsigned char remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0, 0, 0, /* 0x30 - 0x37 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0x52, 0x53, 0x54, 0x55, 0x56, 0, /* 0x50 - 0x57 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 - 0x67 */ - 0x68, 0x69, 0x6a, 0x6b, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0x70, 0x71, 0x72, 0x73, 0x74, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; -#endif /* PC98 */ - /* This table assumes the ibm code page 437 coding for characters * > 0x80. They are returned in this form by PCVT */ @@ -458,11 +436,7 @@ xf86KbdGetMapping (pKeySyms, pModMap) if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) { for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) -#ifdef PC98 - if (remap[i] || i == 0) { -#else if (remap[i]) { -#endif k = map + (remap[i] << 2); k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ k[1] = KD_GET_ENTRY(i,1); /* shifted */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h index 82a485ff4..d53e0f916 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.12 1999/04/29 05:12:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.13 2000/08/11 17:27:13 dawes Exp $ */ /* * * For Scancodes see notes in atKeynames.h !!!! @@ -7,7 +7,6 @@ /* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { -#ifndef PC98 /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, @@ -136,135 +135,6 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, -#else /* PC98 */ - /* 0x00 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_1, XK_exclam, XK_kana_NU, NoSymbol, - /* 0x02 */ XK_2, XK_quotedbl, XK_kana_FU, NoSymbol, - /* 0x03 */ XK_3, XK_numbersign, XK_kana_A, XK_kana_a, - /* 0x04 */ XK_4, XK_dollar, XK_kana_U, XK_kana_u, - /* 0x05 */ XK_5, XK_percent, XK_kana_E, XK_kana_e, - /* 0x06 */ XK_6, XK_ampersand, XK_kana_O, XK_kana_o, - /* 0x07 */ XK_7, XK_quoteright, XK_kana_YA, XK_kana_ya, - /* 0x08 */ XK_8, XK_parenleft, XK_kana_YU, XK_kana_yu, - /* 0x09 */ XK_9, XK_parenright, XK_kana_YO, XK_kana_yo, - /* 0x0a */ XK_0, NoSymbol, XK_kana_WA, XK_kana_WO, - /* 0x0b */ XK_minus, XK_equal, XK_kana_HO, NoSymbol, - /* 0x0c */ XK_asciicircum, XK_quoteleft, XK_kana_HE, NoSymbol, - /* 0x0d */ XK_backslash, XK_bar, XK_prolongedsound, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, XK_kana_TA, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, XK_kana_TE, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, XK_kana_I, XK_kana_i, - /* 0x13 */ XK_R, NoSymbol, XK_kana_SU, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, XK_kana_KA, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, XK_kana_N, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, XK_kana_NA, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, XK_kana_NI, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, XK_kana_RA, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, XK_kana_SE, NoSymbol, - /* 0x1a */ XK_at, XK_asciitilde, XK_voicedsound, NoSymbol, - /* 0x1b */ XK_bracketleft, XK_braceleft, XK_semivoicedsound, XK_kana_openingbracket, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_A, NoSymbol, XK_kana_CHI, NoSymbol, - /* 0x1e */ XK_S, NoSymbol, XK_kana_TO, NoSymbol, - /* 0x1f */ XK_D, NoSymbol, XK_kana_SHI, NoSymbol, - /* 0x20 */ XK_F, NoSymbol, XK_kana_HA, NoSymbol, - /* 0x21 */ XK_G, NoSymbol, XK_kana_KI, NoSymbol, - /* 0x22 */ XK_H, NoSymbol, XK_kana_KU, NoSymbol, - /* 0x23 */ XK_J, NoSymbol, XK_kana_MA, NoSymbol, - /* 0x24 */ XK_K, NoSymbol, XK_kana_NO, NoSymbol, - /* 0x25 */ XK_L, NoSymbol, XK_kana_RI, NoSymbol, - /* 0x26 */ XK_semicolon, XK_plus, XK_kana_RE, NoSymbol, - /* 0x27 */ XK_colon, XK_asterisk, XK_kana_KE, NoSymbol, - /* 0x28 */ XK_bracketright,XK_braceright, XK_kana_MU, XK_kana_closingbracket, - /* 0x29 */ XK_Z, NoSymbol, XK_kana_TSU, NoSymbol, - /* 0x2a */ XK_X, NoSymbol, XK_kana_SA, NoSymbol, - /* 0x2b */ XK_C, NoSymbol, XK_kana_SO, NoSymbol, - /* 0x2c */ XK_V, NoSymbol, XK_kana_HI, NoSymbol, - /* 0x2d */ XK_B, NoSymbol, XK_kana_KO, NoSymbol, - /* 0x2e */ XK_N, NoSymbol, XK_kana_MI, NoSymbol, - /* 0x2f */ XK_M, NoSymbol, XK_kana_MO, NoSymbol, - /* 0x30 */ XK_comma, XK_less, XK_kana_NE, XK_kana_comma, - /* 0x31 */ XK_period, XK_greater, XK_kana_RU, XK_kana_fullstop, - /* 0x32 */ XK_slash, XK_question, XK_kana_ME, XK_kana_middledot, - /* 0x33 */ XK_underscore, XK_underscore, XK_kana_RO, NoSymbol, - /* 0x34 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x35 */ XK_Henkan, XK_Kanji, NoSymbol, NoSymbol, - /* 0x36 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x39 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_Clear, XK_Home, NoSymbol, NoSymbol, - /* 0x3f */ XK_Help, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, - /* 0x4c */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Equal, NoSymbol, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_Separator,NoSymbol, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, - /* 0x51 */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol, - /* 0x52 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x53 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x54 */ XK_F13, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ XK_F14, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_F15, NoSymbol, NoSymbol, NoSymbol, - /* 0x57 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x65 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x6a */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ XK_kana_switch, NoSymbol, XK_kana_switch, NoSymbol, - /* 0x73 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x74 */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, -#endif /* PC98 */ }; #if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && !defined(linux) && !defined(CSRG_BASED) diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c b/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c index 7349b4e6c..799089361 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1999 by The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.5 2000/04/17 16:29:53 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.6 2000/08/04 16:13:25 eich Exp $ */ /* * This file contains the Pointer/Keyboard functions needed by the @@ -34,7 +34,7 @@ #include "xf86OSmouse.h" #include "../input/mouse/mouse.h" -#define DEBUG + #ifdef DEBUG # define DEBUG_P(x) ErrorF(x"\n"); #else @@ -53,7 +53,8 @@ typedef struct { int em3timeout; Bool chordmiddle; int flags; - pointer private; + char* device; + pointer private; } mseParamsRec, *mseParamsPtr; typedef struct { @@ -202,6 +203,15 @@ MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value) } Bool +MiscExtSetMouseDevice(pointer mouse, char* device) +{ + mseParamsPtr mse = mouse; + + mse->device = device; + return TRUE; +} + +Bool MiscExtGetKbdSettings(pointer *kbd) { kbdParamsPtr kbdptr; @@ -411,6 +421,9 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) if (reopen) (pMse->device->deviceProc)(pMse->device, DEVICE_ON); /* Set pInfo->options too */ + + if (mse->device) + xf86ReplaceStrOption(pInfo->options, "Device", mse->device); } if (mse_or_kbd == MISC_KEYBOARD) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h index 66571e416..4bb128eaa 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.9 1999/06/05 15:55:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.10 2000/08/04 16:13:25 eich Exp $ */ /* Option handling things that ModuleSetup procs can use */ @@ -75,5 +75,7 @@ Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value); Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def); int xf86NameCmp(const char *s1, const char *s2); char *xf86NormalizeName(const char *s); - +pointer xf86ReplaceIntOption(pointer optlist, char *name, int val); +pointer xf86ReplaceBoolOption(pointer optlist, char *name, Bool val); +pointer xf86ReplaceStrOption(pointer optlist, char *name, char* val); #endif diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c index 538514de8..122d10b8f 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.15 2000/06/20 05:08:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.20 2000/08/09 20:33:20 tsi Exp $ */ /* * Copyright (c) 1998 by The XFree86 Project, Inc. @@ -183,11 +183,36 @@ xf86SetBoolOption(pointer optlist, const char *name, int deflt) return deflt; } +/* + * addNewOption() has the required property of replacing the option value + * it the option is alread present. + */ +pointer +xf86ReplaceIntOption(pointer optlist, char *name, int val) +{ + char *tmp = xnfalloc(16); + sprintf(tmp,"%i",val); + return xf86AddNewOption(optlist,name,tmp); +} + +pointer +xf86ReplaceBoolOption(pointer optlist, char *name, Bool val) +{ + return xf86AddNewOption(optlist,name,(Bool)val?"True":"False"); +} + +pointer +xf86ReplaceStrOption(pointer optlist, char *name, char* val) +{ + return xf86AddNewOption(optlist,name,val); +} pointer xf86AddNewOption(pointer head, char *name, char *val) { - return addNewOption(head, name, val); + char *tmp = strdup(val); + + return addNewOption(head, name, tmp); } @@ -424,32 +449,37 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) p->name); p->found = FALSE; } else { - p->value.freq.freq = strtod(s, &end); - p->value.freq.units = 0; + double freq = strtod(s, &end); + int units = 0; + if (end != s) { p->found = TRUE; if (!xf86NameCmp(end, "Hz")) - p->value.freq.units = 1; + units = 1; else if (!xf86NameCmp(end, "kHz") || !xf86NameCmp(end, "k")) - p->value.freq.units = 1000; + units = 1000; else if (!xf86NameCmp(end, "MHz") || !xf86NameCmp(end, "M")) - p->value.freq.units = 1000000; + units = 1000000; else { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } - if (p->found && p->value.freq.units > 0) - p->value.freq.freq *= (double)p->value.freq.units; + if (p->found) + freq *= (double)units; } else { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } + if (p->found) { + p->value.freq.freq = freq; + p->value.freq.units = units; + } } break; case OPTV_NONE: diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index 38e05cc6e..060c4ef7d 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.65 2000/06/30 17:15:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.67 2000/08/11 21:12:48 dawes Exp $ */ /* * PCI Probe * @@ -143,6 +143,7 @@ #define PCI_VENDOR_CYCLADES 0x120E #define PCI_VENDOR_3DFX 0x121A #define PCI_VENDOR_SIGMADESIGNS 0x1236 +#define PCI_VENDOR_SMI 0x126f #define PCI_VENDOR_ENSONIQ 0x1274 #define PCI_VENDOR_ROCKWELL 0x127A #define PCI_VENDOR_YOKOGAWA 0x1281 @@ -466,6 +467,13 @@ #define PCI_CHIP_GEFORCE256 0x0100 #define PCI_CHIP_GEFORCEDDR 0x0101 #define PCI_CHIP_QUADRO 0x0103 +#define PCI_CHIP_GEFORCE2MX 0x0110 +#define PCI_CHIP_GEFORCE2MXDDR 0x0111 +#define PCI_CHIP_QUADRO2MXR 0x0113 +#define PCI_CHIP_GEFORCE2GTS 0x0150 +#define PCI_CHIP_GEFORCE2GTS_1 0x0151 +#define PCI_CHIP_GEFORCE2GTS_2 0x0152 +#define PCI_CHIP_QUADRO2PRO 0x0153 /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 @@ -556,6 +564,14 @@ #define PCI_CHIP_I810_E 0x7125 #define PCI_CHIP_I740_AGP 0x7800 +/* Silicon Motion Inc. */ +#define PCI_CHIP_SMI910 0x910 +#define PCI_CHIP_SMI810 0x810 +#define PCI_CHIP_SMI820 0x820 +#define PCI_CHIP_SMI710 0x710 +#define PCI_CHIP_SMI712 0x712 +#define PCI_CHIP_SMI720 0x720 + /* * first the VendorId - VendorName mapping */ @@ -674,6 +690,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_ATRONICS, "Atronics"}, {PCI_VENDOR_ARK, "ARK Logic"}, {PCI_VENDOR_YAMAHA, "Yamaha"}, + {PCI_VENDOR_SMI, "Silicon Motion Inc."}, {0,NULL} }; #endif @@ -1155,6 +1172,13 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_GEFORCE256, "GeForce 256",0}, {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, {PCI_CHIP_QUADRO, "Quadro",0}, + {PCI_CHIP_GEFORCE2MX, "GeForce2 MX",0}, + {PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX DDR",0}, + {PCI_CHIP_QUADRO2MXR, "GeForce2 MXR",0}, + {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS",0}, + {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0}, + {PCI_CHIP_GEFORCE2GTS_2,"GeForce2 GTS (rev 2)",0}, + {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_IMS, { @@ -1432,6 +1456,14 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {0x000a, "YMF740-V Audio",0}, {0x0000, NULL,0}}}, #endif + {PCI_VENDOR_SMI, { + {PCI_CHIP_SMI910, "Lynx",0}, + {PCI_CHIP_SMI810, "LynxE",0}, + {PCI_CHIP_SMI820, "Lynx3D",0}, + {PCI_CHIP_SMI710, "LynxEM",0}, + {PCI_CHIP_SMI712, "LynxEM+",0}, + {PCI_CHIP_SMI720, "Lynx3DM",0}, + {0x0000, NULL,0}}}, {0x0000, { {0x0000, NULL,0}}}, }; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h index d1ca38b88..ebc288393 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.9 2000/04/23 19:26:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.11 2000/07/11 16:14:57 tsi Exp $ */ #ifndef _XF86_RESOURCES_H @@ -110,5 +110,3 @@ extern resRange PciAvoid[]; #define RES_UNDEFINED NULL #endif - - diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c index 331893bf3..dc7bda384 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.15 2000/06/10 18:10:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.16 2000/07/14 22:38:49 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -11,6 +11,30 @@ static int xf86FBMangerIndex = -1; static unsigned long xf86ManagerGeneration = 0; +typedef struct _FBLink { + FBArea area; + struct _FBLink *next; +} FBLink, *FBLinkPtr; + +typedef struct _FBLinearLink { + FBLinear linear; + FBAreaPtr area; + struct _FBLinearLink *next; +} FBLinearLink, *FBLinearLinkPtr; + + +typedef struct { + ScreenPtr pScreen; + RegionPtr InitialBoxes; + RegionPtr FreeBoxes; + FBLinkPtr UsedAreas; + int NumUsedAreas; + FBLinearLinkPtr LinearAreas; + CloseScreenProcPtr CloseScreen; + int NumCallbacks; + FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback; + DevUnion *devPrivates; +} FBManager, *FBManagerPtr; Bool xf86RegisterOffscreenManager( ScreenPtr pScreen, @@ -78,6 +102,27 @@ xf86AllocateOffscreenArea( } +FBLinearPtr +xf86AllocateOffscreenLinear( + ScreenPtr pScreen, + int length, + int gran, + MoveLinearCallbackProcPtr moveCB, + RemoveLinearCallbackProcPtr removeCB, + pointer privData +){ + FBManagerFuncsPtr funcs; + + if(xf86FBMangerIndex < 0) + return NULL; + if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + return NULL; + + return (*funcs->AllocateOffscreenLinear)( + pScreen, length, gran, moveCB, removeCB, privData); +} + + void xf86FreeOffscreenArea(FBAreaPtr area) { @@ -97,6 +142,25 @@ xf86FreeOffscreenArea(FBAreaPtr area) } +void +xf86FreeOffscreenLinear(FBLinearPtr area) +{ + FBManagerFuncsPtr funcs; + + if(!area) return; + + if(xf86FBMangerIndex < 0) + return; + if(!(funcs = + (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + return; + + (*funcs->FreeOffscreenLinear)(area); + + return; +} + + Bool xf86ResizeOffscreenArea( FBAreaPtr resize, @@ -115,6 +179,24 @@ xf86ResizeOffscreenArea( return (*funcs->ResizeOffscreenArea)(resize, w, h); } +Bool +xf86ResizeOffscreenLinear( + FBLinearPtr resize, + int size +){ + FBManagerFuncsPtr funcs; + + if(!resize) return FALSE; + + if(xf86FBMangerIndex < 0) + return FALSE; + if(!(funcs = + (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + return FALSE; + + return (*funcs->ResizeOffscreenLinear)(resize, size); +} + Bool xf86QueryLargestOffscreenArea( @@ -135,6 +217,24 @@ xf86QueryLargestOffscreenArea( pScreen, w, h, gran, preferences, severity); } +Bool +xf86QueryLargestOffscreenLinear( + ScreenPtr pScreen, + int *size, + int gran, + int severity +){ + FBManagerFuncsPtr funcs; + + if(xf86FBMangerIndex < 0) + return FALSE; + if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + return FALSE; + + return (*funcs->QueryLargestOffscreenLinear)( + pScreen, size, gran, severity); +} + Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen) @@ -636,6 +736,231 @@ localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen) return TRUE; } +static void +LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to) +{ + /* this will never get called */ +} + +static void +LinearRemoveCBWrapper(FBAreaPtr area) +{ + FBManagerPtr offman; + FBLinearLinkPtr pLink, pLinkPrev = NULL; + ScreenPtr pScreen = area->pScreen; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + + pLink = offman->LinearAreas; + if(!pLink) return; + + while(pLink->area != area) { + pLinkPrev = pLink; + pLink = pLink->next; + if(!pLink) return; + } + + /* give the user the callback it is expecting */ + (*pLink->linear.RemoveLinearCallback)(&(pLink->linear)); + + if(pLinkPrev) + pLinkPrev->next = pLink->next; + else offman->LinearAreas = pLink->next; + + xfree(pLink); +} + + +static FBLinearPtr +localAllocateOffscreenLinear( + ScreenPtr pScreen, + int length, + int gran, + MoveLinearCallbackProcPtr moveCB, + RemoveLinearCallbackProcPtr removeCB, + pointer privData +){ + FBManagerPtr offman; + FBLinearLinkPtr link; + FBAreaPtr area; + FBLinearPtr linear = NULL; + BoxPtr extents; + int w, h; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + + if(!(link = xalloc(sizeof(FBLinearLink)))) + return NULL; + +#if 0 + if(we have linear heap space) { + if(able to allocate some) { + link->area = NULL; + link->next = offman->LinearAreas; + offman->LinearAreas = link; + linear = link->linear; + linear->pScreen = pScreen; + linear->size = length; + linear->offset = ????; + linear->granularity = gran; + linear->MoveLinearAreaCallback = moveCB; + linear->RemoveLinearAreaCallback = removeCB; + linear->devPrivate.ptr = privData; + return linear; + } /* else fallthrough */ + } +#endif + + extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); + w = extents->x2 - extents->x1; + + if(gran && ((gran > w) || (w % gran))) { + /* we can't match the specified alignment with XY allocations */ + xfree(link); + return NULL; + } + + if(length < w) { /* special case */ + h = 1; + w = length; + } else { + h = (length + w - 1) / w; + } + + if((area = localAllocateOffscreenArea(pScreen, w, h, gran, + moveCB ? LinearMoveCBWrapper : NULL, + removeCB ? LinearRemoveCBWrapper : NULL, + privData))) + { + link->area = area; + link->next = offman->LinearAreas; + offman->LinearAreas = link; + linear = &(link->linear); + linear->pScreen = pScreen; + linear->size = h * w; + linear->offset = (w * area->box.y1) + area->box.x1; + linear->granularity = gran; + linear->MoveLinearCallback = moveCB; + linear->RemoveLinearCallback = removeCB; + linear->devPrivate.ptr = privData; + } else + xfree(link); + + return linear; +} + + +static void +localFreeOffscreenLinear(FBLinearPtr linear) +{ + FBManagerPtr offman; + FBLinearLinkPtr pLink, pLinkPrev = NULL; + ScreenPtr pScreen = linear->pScreen; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + + pLink = offman->LinearAreas; + if(!pLink) return; + + while(&(pLink->linear) != linear) { + pLinkPrev = pLink; + pLink = pLink->next; + if(!pLink) return; + } + + if(pLink->area) { /* really an XY area */ + localFreeOffscreenArea(pLink->area); + } else { + /* free the linear area */ + } + + if(pLinkPrev) + pLinkPrev->next = pLink->next; + else offman->LinearAreas = pLink->next; + + xfree(pLink); +} + + +static Bool +localResizeOffscreenLinear(FBLinearPtr resize, int length) +{ + FBManagerPtr offman; + FBLinearLinkPtr pLink, pLinkPrev = NULL; + ScreenPtr pScreen = resize->pScreen; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + + pLink = offman->LinearAreas; + if(!pLink) return FALSE; + + while(&(pLink->linear) != resize) { + pLinkPrev = pLink; + pLink = pLink->next; + if(!pLink) return FALSE; + } + + /* This could actually be alot smarter and try to move allocations + from XY to linear when available. For now if it was XY, we keep + it XY */ + + if(pLink->area) { /* really an XY area */ + BoxPtr extents; + int w, h; + + extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); + w = extents->x2 - extents->x1; + + if(length < w) { /* special case */ + h = 1; + w = length; + } else { + h = (length + w - 1) / w; + } + + if(localResizeOffscreenArea(pLink->area, w, h)) { + resize->size = h * w; + resize->offset = (w * pLink->area->box.y1) + pLink->area->box.x1; + return TRUE; + } + } else { + /* resize the linear area */ + } + + return FALSE; +} + + +static Bool +localQueryLargestOffscreenLinear( + ScreenPtr pScreen, + int *size, + int gran, + int priority +) +{ + int w, h; + + *size = 0; + + /* for now, we only look at XY space */ + if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran, + FAVOR_WIDTH_THEN_AREA, priority)) + { + FBManagerPtr offman; + BoxPtr extents; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); + if((extents->x2 - extents->x1) == w) + *size = w * h; + return TRUE; + } + + return FALSE; +} + + static FBManagerFuncs xf86FBManFuncs = { localAllocateOffscreenArea, @@ -643,6 +968,10 @@ static FBManagerFuncs xf86FBManFuncs = { localResizeOffscreenArea, localQueryLargestOffscreenArea, localRegisterFreeBoxCallback, + localAllocateOffscreenLinear, + localFreeOffscreenLinear, + localResizeOffscreenLinear, + localQueryLargestOffscreenLinear, localPurgeUnlockedOffscreenAreas }; @@ -651,6 +980,7 @@ static Bool xf86FBCloseScreen (int i, ScreenPtr pScreen) { FBLinkPtr pLink, tmp; + FBLinearLinkPtr pLinearLink, tmp2; FBManagerPtr offman = (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr; @@ -658,13 +988,19 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen) pScreen->CloseScreen = offman->CloseScreen; pLink = offman->UsedAreas; - while(pLink) { tmp = pLink; pLink = pLink->next; xfree(tmp); } + pLinearLink = offman->LinearAreas; + while(pLinearLink) { + tmp2 = pLinearLink; + pLinearLink = pLinearLink->next; + xfree(tmp2); + } + REGION_DESTROY(pScreen, offman->InitialBoxes); REGION_DESTROY(pScreen, offman->FreeBoxes); @@ -742,6 +1078,7 @@ xf86InitFBManagerRegion( offman->pScreen = pScreen; offman->UsedAreas = NULL; + offman->LinearAreas = NULL; offman->NumUsedAreas = 0; offman->NumCallbacks = 0; offman->FreeBoxesUpdateCallback = NULL; @@ -750,82 +1087,48 @@ xf86InitFBManagerRegion( return TRUE; } -/*************************************************************\ - These functions are specific to this implementation and - may only be called by the driver that initialized this - implementation. -\*************************************************************/ +/* This is an implementation specific function and should + disappear after the next release. People should use the + real linear functions instead */ -FBAreaPtr -xf86AllocateLinearOffscreenArea( - ScreenPtr pScreen, - int length, - int gran, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData +FBAreaPtr +xf86AllocateLinearOffscreenArea ( + ScreenPtr pScreen, + int length, + int gran, + MoveAreaCallbackProcPtr moveCB, + RemoveAreaCallbackProcPtr removeCB, + pointer privData ){ - FBManagerPtr offman; - FBLinkPtr link = NULL; - FBAreaPtr area = NULL; - RegionRec NewReg; - BoxPtr boxp, box1p = NULL; - int i, num, w, h; - - if(xf86FBScreenIndex < 0) - return NULL; - if(!(offman = pScreen->devPrivates[xf86FBScreenIndex].ptr)) - return NULL; - - if (offman->InitialBoxes->extents.x1 != 0 || - length <= 0) return NULL; - - w = offman->InitialBoxes->extents.x2 - - offman->InitialBoxes->extents.x1; - h = (length + w - 1) / w; - - /* look through the free boxes, - bottom up to reduce fragmentation troubles */ - - boxp = REGION_RECTS(offman->FreeBoxes); - num = REGION_NUM_RECTS(offman->FreeBoxes); - - for (i = 0; i < num; i++, boxp++) { - if (((boxp->y2 - boxp->y1) < h) || - ((boxp->x2 - boxp->x1) < w) || - (box1p && box1p->y1 > boxp->y1)) - continue; - - box1p = boxp; - } + FBManagerFuncsPtr funcs; + FBManagerPtr offman; + BoxPtr extents; + int w, h; - if (!box1p) return NULL; - link = xalloc(sizeof(FBLink)); - if (!link) return NULL; - area = &(link->area); + if(xf86FBMangerIndex < 0) + return NULL; + if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + return NULL; - area->pScreen = pScreen; - area->granularity = gran; - area->box.x1 = box1p->x1; /* Presumed zero */ - area->box.x2 = box1p->x1 + w; - area->box.y1 = box1p->y2 - h; - area->box.y2 = box1p->y2; - area->MoveAreaCallback = moveCB; - area->RemoveAreaCallback = removeCB; - area->devPrivate.ptr = privData; + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - REGION_INIT(pScreen, &NewReg, &(area->box), 1); - REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg); - REGION_UNINIT(pScreen, &NewReg); + extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); + w = extents->x2 - extents->x1; - link->next = offman->UsedAreas; - offman->UsedAreas = link; - offman->NumUsedAreas++; + if(gran && ((gran > w) || (w % gran))) { + /* we can't match the specified alignment with XY allocations */ + return NULL; + } - SendCallFreeBoxCallbacks(offman); + if(length <= w) { /* special case */ + h = 1; + w = length; + } else { + h = (length + w - 1) / w; + } - return area; + return (*funcs->AllocateOffscreenArea)( + pScreen, w, h, gran, moveCB, removeCB, privData); } - diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h index 3504fa18f..0a6cea792 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.10 2000/06/10 18:10:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.11 2000/07/14 22:38:50 mvojkovi Exp $ */ #ifndef _XF86FBMAN_H #define _XF86FBMAN_H @@ -27,26 +27,23 @@ typedef struct _FBArea { DevUnion devPrivate; } FBArea, *FBAreaPtr; -typedef struct _FBLink { - FBArea area; - struct _FBLink *next; -} FBLink, *FBLinkPtr; +typedef struct _FBLinear { + ScreenPtr pScreen; + int size; + int offset; + int granularity; + void (*MoveLinearCallback)(struct _FBLinear*, struct _FBLinear*); + void (*RemoveLinearCallback)(struct _FBLinear*); + DevUnion devPrivate; +} FBLinear, *FBLinearPtr; typedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer); typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr); typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr); -typedef struct { - ScreenPtr pScreen; - RegionPtr InitialBoxes; - RegionPtr FreeBoxes; - FBLinkPtr UsedAreas; - int NumUsedAreas; - CloseScreenProcPtr CloseScreen; - int NumCallbacks; - FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback; - DevUnion *devPrivates; -} FBManager, *FBManagerPtr; +typedef void (*MoveLinearCallbackProcPtr)(FBLinearPtr, FBLinearPtr); +typedef void (*RemoveLinearCallbackProcPtr)(FBLinearPtr); + typedef struct { FBAreaPtr (*AllocateOffscreenArea)( @@ -68,6 +65,21 @@ typedef struct { ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, pointer devPriv); +/* linear functions */ + FBLinearPtr (*AllocateOffscreenLinear)( + ScreenPtr pScreen, + int size, + int granularity, + MoveLinearCallbackProcPtr moveCB, + RemoveLinearCallbackProcPtr removeCB, + pointer privData); + void (*FreeOffscreenLinear)(FBLinearPtr area); + Bool (*ResizeOffscreenLinear)(FBLinearPtr area, int size); + Bool (*QueryLargestOffscreenLinear)( + ScreenPtr pScreen, + int *size, + int granularity, + int priority); Bool (*PurgeOffscreenAreas) (ScreenPtr); } FBManagerFuncs, *FBManagerFuncsPtr; @@ -114,7 +126,18 @@ xf86AllocateLinearOffscreenArea ( pointer privData ); +FBLinearPtr +xf86AllocateOffscreenLinear ( + ScreenPtr pScreen, + int length, + int granularity, + MoveLinearCallbackProcPtr moveCB, + RemoveLinearCallbackProcPtr removeCB, + pointer privData +); + void xf86FreeOffscreenArea(FBAreaPtr area); +void xf86FreeOffscreenLinear(FBLinearPtr area); Bool xf86ResizeOffscreenArea( @@ -122,6 +145,13 @@ xf86ResizeOffscreenArea( int w, int h ); +Bool +xf86ResizeOffscreenLinear( + FBLinearPtr resize, + int size +); + + Bool xf86RegisterFreeBoxCallback( ScreenPtr pScreen, @@ -144,4 +174,13 @@ xf86QueryLargestOffscreenArea( int priority ); +Bool +xf86QueryLargestOffscreenLinear( + ScreenPtr pScreen, + int *size, + int granularity, + int priority +); + + #endif /* _XF86FBMAN_H */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c index e4e5b45ed..0b856ac9d 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.18 2000/06/20 05:08:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.20 2000/08/04 16:13:26 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -193,11 +193,29 @@ FindPCIVideoInfo(void) info->type[j] = 0; } + if (!(pcrp->pci_base0) && info->size[0] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base0 = pciCheckForBrokenBase(pcrp->tag,0); + if (!(pcrp->pci_base1) && info->size[1] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base1 = pciCheckForBrokenBase(pcrp->tag,1); + if (!(pcrp->pci_base2) && info->size[2] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base2 = pciCheckForBrokenBase(pcrp->tag,2); + if (!(pcrp->pci_base3) && info->size[3] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base3 = pciCheckForBrokenBase(pcrp->tag,3); + if (!(pcrp->pci_base4) && info->size[4] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base4 = pciCheckForBrokenBase(pcrp->tag,4); + if (!(pcrp->pci_base5) && info->size[5] + && PCINONSYSTEMCLASSES(info->class, info->subclass)) + pcrp->pci_base5 = pciCheckForBrokenBase(pcrp->tag,5); + /* * 64-bit base addresses are checked for and avoided. * XXX Should deal with them on platforms that support them. */ - if (pcrp->pci_base0) { if (pcrp->pci_base0 & PCI_MAP_IO) { info->ioBase[0] = (memType)PCIGETIO(pcrp->pci_base0); @@ -1207,10 +1225,8 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) (*p_size)++; (*p_base) = H2B(tag,range.rBegin,type); -#ifdef DEBUG ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n", res_n,(*p_base),(1 << (*p_size)),type | ResMem ? "Mem" : "Io"); -#endif if (res_n != 0xff) { pciWriteLong(tag,PCI_CMD_BASE_REG + res_n * sizeof(CARD32), @@ -1724,7 +1740,6 @@ ValidatePci(void) resPtr tmp, avoid = NULL; if (!pvp->validate) continue; - avoid = xf86DupResList(pciAvoidRes); NonSys = xf86DupResList(Sys); m = n; while ((pvp1 = xf86PciVideoInfo[m++])) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.c b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c index cd0331bc5..70d5aa482 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86xv.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c @@ -6,7 +6,7 @@ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.26 2000/06/09 22:41:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.28 2000/08/05 03:32:37 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -694,14 +694,14 @@ xf86XVRegetVideo(XvPortRecPrivatePtr portPriv) &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) - portPriv->isOn = TRUE; + portPriv->isOn = XV_ON; CLIP_VIDEO_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ @@ -782,14 +782,14 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv) portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); - if(ret == Success) portPriv->isOn = TRUE; + if(ret == Success) portPriv->isOn = XV_ON; CLIP_VIDEO_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ @@ -866,14 +866,14 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) WinBox.x1, WinBox.y1, &ClipRegion, portPriv->DevPriv.ptr); - portPriv->isOn = (ret == Success); + portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF; CLIP_VIDEO_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ @@ -982,10 +982,10 @@ xf86XVDestroyWindow(WindowPtr pWin) while(WinPriv) { XvPortRecPrivatePtr pPriv = WinPriv->PortRec; - if(pPriv->isOn) { + if(pPriv->isOn > XV_OFF) { (*pPriv->AdaptorRec->StopVideo)( pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); - pPriv->isOn = FALSE; + pPriv->isOn = XV_OFF; } pPriv->pDraw = NULL; @@ -1043,9 +1043,11 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) else if(AreasExposed) { XF86XVWindowPtr tmp; - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = FALSE; + if (pPriv->isOn == XV_ON) { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); + pPriv->isOn = XV_PENDING; + } pPriv->pDraw = NULL; if(!pPrev) @@ -1089,9 +1091,11 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) window isn't visible. But we only remove the images. */ if(pPriv->type || !visible) { - (*pPriv->AdaptorRec->StopVideo)( + if(pPriv->isOn == XV_ON) { + (*pPriv->AdaptorRec->StopVideo)( pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = FALSE; + pPriv->isOn = XV_PENDING; + } if(!pPriv->type) { /* overlaid still/image */ pPriv->pDraw = NULL; @@ -1204,10 +1208,11 @@ xf86XVLeaveVT(int index, int flags) for(j = 0; j < pAdaptor->nPorts; j++) { pPort = &pAdaptor->pPorts[j]; pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; - if(pPriv->isOn) { + if(pPriv->isOn > XV_OFF) { + (*pPriv->AdaptorRec->StopVideo)( pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); - pPriv->isOn = FALSE; + pPriv->isOn = XV_OFF; if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pScreen, pPriv->pCompositeClip); @@ -1248,7 +1253,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) for(i = pa->nPorts; i > 0; i--, pPort++) { pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; - if(!pPriv->type && pPriv->isOn) { /* overlaid still/image */ + if(!pPriv->type && (pPriv->isOn == XV_ON)) { /* overlaid still/image */ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pScreen, pPriv->pCompositeClip); @@ -1266,7 +1271,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) (*pPriv->AdaptorRec->StopVideo)( pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); xf86XVRemovePortFromWindow(pWin, pPriv); - pPriv->isOn = FALSE; + pPriv->isOn = XV_PENDING; continue; } } @@ -1424,7 +1429,7 @@ xf86XVPutStill( (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) { xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - portPriv->isOn = TRUE; + portPriv->isOn = XV_ON; portPriv->pDraw = pDraw; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; @@ -1435,10 +1440,10 @@ xf86XVPutStill( PUT_STILL_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); @@ -1548,10 +1553,10 @@ xf86XVGetStill( GET_STILL_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); @@ -1579,10 +1584,10 @@ xf86XVStopVideo( /* Must free resources. */ - if(portPriv->isOn) { + if(portPriv->isOn > XV_OFF) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, TRUE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_OFF; } return Success; @@ -1720,7 +1725,7 @@ xf86XVPutImage( (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - portPriv->isOn = TRUE; + portPriv->isOn = XV_ON; portPriv->pDraw = pDraw; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; @@ -1731,10 +1736,10 @@ xf86XVPutImage( PUT_IMAGE_BAILOUT: - if((clippedAway || (ret != Success)) && portPriv->isOn) { + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo)( portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = FALSE; + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h index 48b29159f..bae9ca4b0 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.17 2000/06/09 22:41:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.18 2000/08/04 16:13:26 eich Exp $ */ #ifndef _XVDIX_H_ #define _XVDIX_H_ @@ -87,6 +87,12 @@ typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, int image, unsigned short *width, unsigned short *height, int *pitches, int *offsets); +typedef enum { + XV_OFF, + XV_PENDING, + XV_ON +} XvStatus; + /*** this is what the driver needs to fill out ***/ typedef struct { @@ -235,7 +241,7 @@ typedef struct { RegionPtr pCompositeClip; Bool FreeCompositeClip; XvAdaptorRecPrivatePtr AdaptorRec; - Bool isOn; + XvStatus isOn; Bool moved; int vid_x, vid_y, vid_w, vid_h; int drw_x, drw_y, drw_w, drw_h; diff --git a/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c b/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c index 9cfc7d90b..c0092aed9 100644 --- a/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c +++ b/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c,v 1.7 2000/04/17 16:29:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c,v 1.8 2000/07/13 21:31:37 tsi Exp $ */ /* interpret_edid.c: interpret a primary EDID block * @@ -158,9 +158,10 @@ copy_string(Uchar *c, Uchar *s) { int i; c = c + 5; - for (i = 0; (i < 13 && *s != 0x0A); i++) + for (i = 0; (i < 13 && *c != 0x0A); i++) *(s++) = *(c++); *s = 0; + while (i-- && (*--s == 0x20)) *s = 0; } static void diff --git a/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c b/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c index ab1c8c601..02309aeb8 100644 --- a/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c +++ b/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.12 2000/06/07 22:03:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.14 2000/07/13 21:31:38 tsi Exp $ */ /* print_edid.c: print out all information retrieved from display device * @@ -96,15 +96,15 @@ print_input_features(int scrnIndex, struct disp_features *c) } if (SIG_SETUP(c->input_setup)) xf86DrvMsg(scrnIndex,X_INFO,"Signal levels configurable\n"); - xf86DrvMsg(scrnIndex,X_INFO,"Sync: "); + xf86DrvMsg(scrnIndex,X_INFO,"Sync:"); if (SEP_SYNC(c->input_sync)) - xf86ErrorF("Separate "); + xf86ErrorF(" Separate"); if (COMP_SYNC(c->input_sync)) - xf86ErrorF("Composite "); + xf86ErrorF(" Composite"); if (SYNC_O_GREEN(c->input_sync)) - xf86ErrorF("SyncOnGreen "); + xf86ErrorF(" SyncOnGreen"); if (SYNC_SERR(c->input_sync)) - xf86ErrorF("\n Serration on" + xf86ErrorF("Serration on. " "V.Sync Pulse req. if CompSync or SyncOnGreen\n"); else xf86ErrorF("\n"); } @@ -131,6 +131,7 @@ print_dpms_features(int scrnIndex, struct disp_features *c) xf86ErrorF("; Non RGB Multicolor Display\n"); break; default: + xf86ErrorF("\n"); break; } if (STD_COLOR_SPACE(c->msc)) @@ -217,13 +218,13 @@ print_detailed_monitor_section(int scrnIndex, print_detailed_timings(scrnIndex,&m[i].section.d_timings); break; case DS_SERIAL: - xf86DrvMsg(scrnIndex,X_INFO,"Serial No: %s",m[i].section.serial); + xf86DrvMsg(scrnIndex,X_INFO,"Serial No: %s\n",m[i].section.serial); break; case DS_ASCII_STR: - xf86DrvMsg(scrnIndex,X_INFO," %s",m[i].section.ascii_data); + xf86DrvMsg(scrnIndex,X_INFO," %s\n",m[i].section.ascii_data); break; case DS_NAME: - xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s",m[i].section.name); + xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",m[i].section.name); break; case DS_RANGES: xf86DrvMsg(scrnIndex,X_INFO, @@ -231,7 +232,7 @@ print_detailed_monitor_section(int scrnIndex, m[i].section.ranges.min_v, m[i].section.ranges.max_v, m[i].section.ranges.min_h, m[i].section.ranges.max_h); if (m[i].section.ranges.max_clock != 0) - xf86ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock); + xf86ErrorF(" PixClock max %i kHz\n",m[i].section.ranges.max_clock); else xf86DrvMsg(scrnIndex,X_INFO,"\n"); break; diff --git a/xc/programs/Xserver/hw/xfree86/doc/BugReport b/xc/programs/Xserver/hw/xfree86/doc/BugReport index 371d6de1b..4f7d0bc4e 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/BugReport +++ b/xc/programs/Xserver/hw/xfree86/doc/BugReport @@ -5,7 +5,7 @@ XFree86@XFree86.org. Replace the comments in [] with your own text. VERSION: -3.9.18 +4.0.1a VIDEO DRIVER: @@ -53,3 +53,5 @@ REPORT: reproduce it.] + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/BugReport,v 1.3 2000/08/03 12:24:02 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/DESIGN b/xc/programs/Xserver/hw/xfree86/doc/DESIGN index 3155abc0a..56ddd606a 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/DESIGN +++ b/xc/programs/Xserver/hw/xfree86/doc/DESIGN @@ -4541,7 +4541,8 @@ the helpers. clockRanges is a linked list of clock ranges allowed by the driver. If a mode doesn't fit in any of the defined clockRanges, it is rejected. The first clockRange that - matches all requirements is used. + matches all requirements is used. This structure needs + to be initialized to NULL when allocated. clockRanges contains the following fields: @@ -5506,6 +5507,11 @@ initialisation has already been done. After allocating it, initialise the fields. By using xnfcalloc() to do the allocation it is zeroed, and if the allocation fails the server exits. +NOTE: When allocating structures from inside the driver which are defined on +the common level it is importand to initialize the structure to zero. Only +this guarantees that the server remains source compatible to future changes +in common level structures. + static Bool ZZZGetRec(ScrnInfoPtr pScrn) { @@ -6246,8 +6252,10 @@ pScreen->CloseScreen, and finishes by calling it. ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - ZZZRestore(pScrn); - ZZZUnmapMem(pScrn); + if (pScrn->vtSema) { + ZZZRestore(pScrn); + ZZZUnmapMem(pScrn); + } pScrn->vtSema = FALSE; pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -6258,7 +6266,16 @@ pScreen->CloseScreen, and finishes by calling it. Define the SaveScreen() function (the screen blanking function). When using the vgahw module, this will typically be: -This function is mandatory. +This function is mandatory. Before modifying any hardware register directly +this function needs to make sure that the Xserver is active by checking if + + pScrn + + is non-NULL and for + + pScrn->vtSema == TRUE + +. static Bool ZZZSaveScreen(ScreenPtr pScreen, int mode) @@ -6285,7 +6302,6 @@ eScreen() function. ZZZFreeRec(xf86Screens[scrnIndex]); } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.30 2000/06/19 15:00:52 tsi Exp $ - + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.31 2000/08/04 16:13:27 eich Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.26 2000/06/19 15:12:26 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.27 2000/08/04 21:47:20 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Install b/xc/programs/Xserver/hw/xfree86/doc/Install index 3580a61b6..1522642a6 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Install +++ b/xc/programs/Xserver/hw/xfree86/doc/Install @@ -44,9 +44,18 @@ for you to download. If you are careful with this step you will save your- self a lot time and trouble from NOT downloading an incompatible distribu- tion. -Once that is done download the necessary files. The twelve (12) mandatory -files for all installations are listed below. If you have not downloaded all -of the files, the installer script will complain. +NOTE: the Xinstall.sh script must be downloaded in binary mode, otherwise it +won't run correctly. If you get lots of "command not found" messages when +you try to run it, then it is most likely because the script wasn't down- +loaded in binary mode. Some web browsers won't do this for files of that +name, so we also have a copy of it called "Xinstall.bin", and most browsers +should download that correctly. When downloading it under this name, select +"save as" on your browser, and save the file under the name "Xinstall.sh". + +Once you're run the Xinstall.sh script and found which binary distribution is +suitable for your system, download the necessary files. The twelve (12) +mandatory files for all installations are listed below. If you have not +downloaded all of the files, the installer script will complain. 1. Xinstall.sh The installer script 2. extract The utility for extracting tarballs @@ -335,7 +344,7 @@ Once that's done, the main part of the installation can be done: /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.6 2000/07/02 02:35:27 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.7 2000/07/03 16:51:11 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.5 2000/07/02 02:46:26 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.6 2000/07/03 16:51:32 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README b/xc/programs/Xserver/hw/xfree86/doc/README index 995f72a7c..1b004e4e0 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README +++ b/xc/programs/Xserver/hw/xfree86/doc/README @@ -146,7 +146,7 @@ The contrib part of the distribution has been folded into the main source tree, so a separate contrib tarball is no longer required. To format the XFree86 documentation use the latest version of our doctools -package available as doctools-1.1.3.tgz. +package available as doctools-1.2.tgz. 5. Reporting Bugs @@ -157,7 +157,7 @@ yourself, send the entire log file with your bug report but not the operating system core dump. Do not edit the log file as our developers use it to reproduce and debug your problem. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.106 2000/07/02 02:35:27 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.107 2000/07/02 16:35:56 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.105 2000/07/02 02:46:26 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.106 2000/07/03 16:30:34 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati index ec2c247a7..c9b63b444 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.ati +++ b/xc/programs/Xserver/hw/xfree86/doc/README.ati @@ -2,7 +2,7 @@ Marc Aurele La France - 2000 June 15 + 2000 August 3 Abstract @@ -80,9 +80,9 @@ sent: The driver also supports 32K, 64K and 16M-colour modes on the 264xT and 3D Rage series of adapters using the accelerator CRTC (but not the VGA CRTC). -The newer Rage 128 chips are not yet supported by this driver. Rage 128's -are, however, supported by a separate driver, and Rage 128 owners should read -the r128 driver's documentation for details. +The newer Rage 128 and Radeon chips are not yet supported by this driver. +Rage 128's are, however, supported by a separate driver, and Rage 128 owners +should read the r128 driver's documentation for details. Adapters based on the above chips have been marketed under a rather large number of names over the years. Among them are: @@ -135,8 +135,12 @@ is used. XF86Config options are available to disable this aperture, or (for non-PCI adapters) enable it or move it to some other address. By default, the driver provides some acceleration for Mach64 if the accelera- -tor CRTC is used. This support is as yet incomplete and can be disabled -entirely with an XF86Config option. +tor CRTC is used, and modes whose colour depth greater than or equal to 8 are +to be used. This support is as yet incomplete and can be disabled entirely +with an XF86Config option. + +On non-Intel platforms, the driver can, currenly, only support PCI Mach64 +adapters. 4. Current implementation of generic VGA support for non-ATI adapters @@ -144,7 +148,7 @@ Support for generic VGA with non-ATI adapters is also implemented, but has undergone only limited testing. The driver will intentionally disallow the use of this support with ATI adapters. This support must be explicitly requested through an XF86Config ChipSet specification. This prevents the -current generic driver from being disabled. +current VGA generic driver from being disabled. This driver's generic VGA support is intended as an extension of that pro- vided by the current generic driver. Specifically, within the architectural @@ -223,6 +227,9 @@ driver to probe for the non-PCI adapter. These ChipSet names should, there- fore, only be used when there is in fact such an adapter in the system. They are otherwise equivalent to ``ati''. +On non-Intel platforms, only ``ati'' and ``mach64'' ChipSet values are opera- +tive. + 5.3 ChipID & ChipRev specifications These specifications will cause the driver to associate the ``Device'' sec- @@ -375,7 +382,7 @@ be used depending on what the adapter uses to generate dot clocks: 25.000 27.500 31.500 33.750 10.000 11.225 12.500 16.250 VGAWonder VLB, VGA 1024 VLB, Mach32 and Mach64 owners should only specify up -to the first 32 frequencies. +to the first 32 frequencies. Any more will be ignored. Other clock generators that have been used on ATI adapters (which can all be said to be clones of one of the above) might generate non-zero frequencies @@ -398,10 +405,9 @@ values used by the adapter. Any more will be ignored. This specification is only effective when the driver detects that the adapter's BIOS has initialised both the digital flat panel and CRT inter- -faces. In such a situation, the driver will normally drive the panel and -disable the CRT. This specification causes the driver to disable the digital -flat panel and display the screen image on the CRT instead. This specifica- -tion will be reworked in the near future. +faces. In such a situation, the driver will normally drive both the panel +and the CRT. This specification causes the driver to disable the digital +flat panel and display the screen image on the CRT instead. 5.8 Option ``noaccel'' @@ -417,6 +423,9 @@ By default, the driver will enable a linear video memory aperture for CRTC or an integrated Mach64 graphics chip. This option disables this linear aperture. +On non-Intel platforms, the driver requires a linear aperture and, so, this +option should not be specified. + 5.10 Option ``shadowfb'' If this option is enabled, the driver will cause the CPU to do each drawing @@ -459,6 +468,26 @@ ing to the PCI Plug'n'Play specification which arbitrates the resource requirements of most devices in the system. This means the driver can not easily change the linear aperture address. +5.14 Option ``ReferenceClock'' ``frequency'' + +This option is only applicable to non-Intel platforms, where an adapter BIOS +is not available to the driver. The option specifies the reference frequency +used by the adapter's clock generator. The default is 14.318 MHz, and other +typical values are 28.636, or 29.5 MHz. + +5.15 ClockChip ``name'' + +This option is only applicable to non-Intel platforms, where an adapter BIOS +is not available to the driver, and the driver cannot reliably determine +whether the clock generator the adapter uses is a variant of an ATI 18818 +(a.k.a. ICS 2595) or an unsupported clock generator. The only values that +are acted upon are ``ATI 18818-0'' or ``ATI 18818-1''. From this specifica- +tion, the driver derives a reference divider of 43 or 46 (respectively) for +use in clock programming calculations. The driver's default behaviour, in +this case, is to assume an unsupported clock generator, which means it will +treat it as a fixed-frequency clock generator, as described under the heading +``Clocks for unsupported programmable clock generators'' above. + 6. Video modes Mode timings can be derived from the information in XFree86's doc subdirec- @@ -639,7 +668,9 @@ found in XFree86 3.3.2, 3.3.3, 3.3.3.1, 3.3.3.2, 3.3.4, 3.3.5 and 3.3.6. Version 5 is an almost complete restructuring of version 4 to fit in the newer driver API of XFree86 4.0 and later. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.31 2000/06/19 15:00:54 tsi Exp $ +The introduction of version 6 is a first swipe at porting the driver to non- +Intel architectures. + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.32 2000/08/04 21:07:11 tsi Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.49 2000/06/19 15:12:28 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.50 2000/08/04 21:47:20 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES index 137f1c498..4e8eec711 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES +++ b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES @@ -2,7 +2,7 @@ The XFree86 Project, Inc - 30 June 2000 + 3 July 2000 Abstract @@ -13,29 +13,22 @@ XFree86 4.0 was the first official release of the new XFree86 4. XFree86 4 represents a significant redesign of the XFree86 X server. Not all of the -hardware drivers from 3.3.x have been ported to 4.x yet. - -1.1 Differences Between the 4.x series and the 3.3 series - -The 4.x release series is also missing a nice configuration tool. This means -that configuring the Xserver might be trickier than usual. The second point -is that is that your hardware might not be supported by 4.0.1, or it might be -supported at a lesser level (conversely, some hardware is better supported in -4.0.1). We've attempted to provide some information about the second point -in our Driver Status document. Please check there first before downloading -4.0.1. - -On the subject of configuration, we have updated the basic text-based tool -"xf86config" to generate config files in the format required by 4.0.1 (3.3.x -config files won't really work with 4.0.1). We're also working on some other -configuration tools, including one that is built-in to the X server. An -early version of this is included in the release, and it works well for some -hardware. To try it out, just run (as root) "XFree86 -configure". Both of -these configuration options will give you a reasonable starting point for a -suitable configuration file. We've put some effort into documenting the -4.0.1 config file format, and you can find that information in the XF86Config -manual page. Check that, the driver manual pages and the related documenta- -tion for further information. +hardware drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x +has some hardware support not present in 3.3.x. We've attempted to provide +some information about the second point in our Driver Status document. +Please check there first before downloading 4.0.1. + +The 4.0.1 has a new configuration tool, "xf86cfg". It is work in progress, +but definitely worth trying out. We have also updated the basic text-based +tool "xf86config" to generate config files in the format required by 4.0.1 +(3.3.x config files won't really work with 4.0.1). We're also on a configu- +ration tool that is built-in to the X server. An early version of this is +included in the release, and it works well for some hardware. To try it out, +just run (as root) "XFree86 -configure". Each of these configuration options +will give you a reasonable starting point for a suitable configuration file. +We've put some effort into documenting the 4.0.1 config file format, and you +can find that information in the XF86Config manual page. Check that, the +driver manual pages and the related documentation for further information. Oh, another thing you might notice is that our documentation is rather patchy. Most of what is present should be in reasonable shape, but there are @@ -84,7 +77,43 @@ enough space to cover it all here. o Add generic DGA support to the sis, neomagic and i810 drivers. - o xf86cfg, a new graphical configuration tool. + o xf86cfg, a new graphical configuration tool for XFree86 4.0, and can be + used to either write the initial configuration or make customizations to + the current configuration. xf86cfg is a work in progress, and allows + configuration of: + + o Specific setup of monitors, cards, keyboards and mice, as well as + adding or removing them. + + o Server layout setup, allowing complex configuration of physical + monitor positions, default color depth and/or rotated monitors. + + o Mode line editor that can be used to configure multiple monitors, + and allows adding a modeline specific to a monitor directly to the + configuration file. + + o AccessX configuration interface, that provides an interface to easy + setup of most AccessX options, including: + + o Timeout to reset controls. + + o StickyKeys, for people with disabilities that cannot press two + keys at the same time. + + o MouseKeys, mouse control only with the keyboard. + + o RepeatKeys, repeat rate and repeat delay. + + o SlowKeys, to avoid pressing keys accidentally, they're only + accepted if pressed for some specific amount of time. + + o BounceKeys, helps avoiding multiple key presses by only + accepting a key if it is pressed only once and not pressed + again in a specific amount of time. + + New configuration options are being worked on, as well as correct- + ing some of the bugs in the current options. A protocol for plugging in + external modules is also planned. 2.2 X libraries and clients. @@ -357,7 +386,6 @@ page for more comprehensive information: Identifier "MGA 1" Driver "mga" BusID "PCI:1:0:0" - Option "PCI Retry" EndSection o The Screen sections are mostly unchanged. The old Driver keyword is no @@ -544,19 +572,14 @@ Known problems: way. This is an issue that needs to be dealt with in the individual window managers, and isn't specifically an XFree86 problem. -3.7 XVideo extension +3.7 DGA version 2 -The XVideo extension is included in this release, but nobody seems interested -in writing up some information about it. +DGA 2.0 is included in 4.0.1, but is not implemented by all drivers. Prelim- +inary documentation for the client libraries can be found in the README.DGA +document. A good degree of backwards compatibility with version 1.0 is pro- +vided. -3.8 DGA version 2 - -DGA 2.0 is nearly completed but still not implemented by all drivers. Pre- -liminary documentation for the client libraries can be found in the xc/pro- -grams/Xserver/hw/xfree86/DGA document. Some degree of backwards compatibil- -ity with version 1.0 is provided. This information is out of date. - -3.9 DDC +3.8 DDC The VESA(R) Display Data Channel (DDC[tm]) standard allows the monitor to tell the video card (or on some cases the computer directly) about itself; @@ -578,7 +601,7 @@ to the and non-DDC default value 75 with the -dpi 75 command line option for the X server, or by specifying appropriate screen dimensions with the "Dis- playSize" keyword in the "Monitor" section of the config file. -3.10 GLX and the Direct Rendering Infrastructure (DRI) +3.9 GLX and the Direct Rendering Infrastructure (DRI) Precision Insight <URL:http://www.precisioninsight.com> has been provided with funding and support from Red Hat <URL:http://www.redhat.com>, SGI @@ -599,7 +622,7 @@ of 2000. Updated information on DRI compatible drivers can be found at the DRI Project <URL:http://dri.sourceforge.net> on SourceForge <URL:http://www.sourceforge.net>. -3.11 X-Video Extension (Xv) +3.10 X-Video Extension (Xv) An XvQueryPortAttributes function has been added as well as support for XvIm- ages. XvImages are XImages in alternate color spaces such as YUV and can be @@ -607,7 +630,7 @@ passed to the server through shared memory segments. This allows clients to display YUV data with high quality hardware scaling and filtering. XvImages are only supported by the Matrox G200/G400 cards at the moment. -3.12 Other extensions +3.11 Other extensions The XFree86-Misc extension has not been fully ported to the new server archi- tecture yet. This should be completed in a future release. @@ -620,7 +643,7 @@ The new xgamma utility makes use of this feature. Compatibility with the 3.3.x version of the extension is provided. The missing parts of this exten- sion and some new features should be completed in a future release. -3.13 Drivers +3.12 Drivers XFree86 4.0.1 includes the following drivers: @@ -663,7 +686,7 @@ but are not complete and/or stable yet. Drivers marked with (+) are for Linux/Sparc only. -3.13.1 APM +3.12.1 APM This is the driver for Alliance AT3D/AT25 and AT24 chips. There is a rather complete support for the functions with acceleration at 8,15,16,24 and 32 @@ -673,11 +696,11 @@ driver is almost ok. The Rush extension for glide2x works, with some addi- tions, including overlay of the result. DGA and DGA2 have been tested ok. Further information can be found in README.apm. -3.13.2 Chips & Technologies +3.12.2 Chips & Technologies Information about the C&T driver can be found in README.chips. -3.13.3 s3virge +3.12.3 s3virge The s3virge driver is a port of the 3.3.x SVGA S3 ViRGE driver. As such it should be as stable and functional as previous XFree86 releases. There are a @@ -705,45 +728,39 @@ Outstanding items not implemented or fully tested: Further information can be found in README.s3virge. -3.13.4 TGA +3.12.4 TGA The TGA driver is now accelerated and supports both 8 and 32 plane frame- buffers. It is known to work under Linux/Alpha. Please see the README.DECtga file for further information. -3.13.5 Matrox +3.12.5 Matrox The MGA driver supports the same range or hardware as XFree86 3.3.4, but has a number of enhancements including multi-head support and support for (non- destructive) overlays (8-bit + 24-bit). -Option "overlay" when the server is started in 32bpp (-fbbpp 32) will enable -the 8+24 mode. The current implementation doesn't optimize away unnecessary -exposures yet so the performance of this option will be better in future -release. By default, the color key for the overlays is 255, but this can be -changed with the "ColorKey" option to work around problems in specific pro- -grams. Valid values for the key are 2-255. - This release contains performance enhancements for the G400 and particularly for the G400 MAX. It also includes XvImage support for G200/G400 chips and improved memory autodetection support. Further information can be found in the mga man page. -3.13.6 ATI +3.12.6 ATI Information about the ATI driver can be found in README.ati <URL:ati.html>. -The current version is not accelerated. Acceleration support is planned for -a future release. +The current version is not accelerated for all supported chips. Some accel- +eration is included for Mach64 chips. -3.13.7 NVIDIA +3.12.7 NVIDIA -The "nv" driver supports all Riva TNT accelerators as well as the new GeForce -and Quadro accelerators. DGA 2.0 support is included. +The "nv" driver supports all Riva TNT accelerators as well as the GeForce 256 +and Quadro accelerators (the GeForce2 and GeForce2 MX are not yet supported). +DGA 2.0 support is included. Further information can be found in the nv man page. -3.13.8 Glide +3.12.8 Glide This driver is for Voodoo 1 and Voodoo 2 boards. It runs X on top of the 3DFX Glide API (where this is available, like for Linux). You need to have Glide @@ -764,7 +781,7 @@ man page. For Voodoo Banshee and Voodoo 3 boards or later: Please use the tdfx driver which talks directly to the hardware and is much faster. -3.13.9 GLINT +3.12.9 GLINT The "glint" driver supports most 3Dlabs/Texas Instruments GLINT/Permedia chips. There is a rather complete support (better than in 3.3.x) for acceler- @@ -1166,7 +1183,7 @@ location pointing to the new location. Some run-time generated files are now located under the appropriate subdirectories of /var, again with the relevant symbolic links in the old location. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.41 2000/07/02 02:35:27 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.42 2000/07/03 16:27:10 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.84 2000/07/02 02:46:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.85 2000/07/03 16:30:35 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml index 98cb80428..00ef4c86f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml @@ -36,7 +36,7 @@ <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.30 2000/06/19 15:00:52 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.31 2000/08/04 16:13:27 eich Exp $ </ident> @@ -5352,6 +5352,7 @@ be catered for the by the helpers. allowed by the driver. If a mode doesn't fit in any of the defined &s.code;clockRanges&e.code;, it is rejected. The first &s.code;clockRange&e.code; that matches all requirements is used. + This structure needs to be initialized to NULL when allocated. &s.code;clockRanges&e.code; contains the following fields: @@ -6493,6 +6494,13 @@ zzzSetup(pointer module, pointer opts, int *errmaj, int *errmin) initialisation has already been done. After allocating it, initialise the fields. By using &s.code;xnfcalloc()&e.code; to do the allocation it is zeroed, and if the allocation fails the server exits. +<p> + NOTE: + When allocating structures from inside the driver which are defined + on the common level it is importand to initialize the structure to + zero. + Only this guarantees that the server remains source compatible to + future changes in common level structures. <code> static Bool @@ -7292,8 +7300,10 @@ static Bool ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - ZZZRestore(pScrn); - ZZZUnmapMem(pScrn); + if (pScrn->vtSema) { + ZZZRestore(pScrn); + ZZZUnmapMem(pScrn); + } pScrn->vtSema = FALSE; pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -7307,7 +7317,10 @@ ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen) blanking function). When using the vgahw module, this will typically be: -This function is mandatory. +This function is mandatory. Before modifying any hardware register directly +this function needs to make sure that the Xserver is active by checking +if <code>pScrn</code> is non-NULL and for <code>pScrn->vtSema == TRUE</code>. + <code> static Bool diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml index 726e481b4..3714fe5fb 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml @@ -9,7 +9,7 @@ <date>30 June 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.6 2000/07/02 02:35:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.7 2000/07/03 16:51:11 dawes Exp $ </ident> <abstract> @@ -70,9 +70,20 @@ for you to download. If you are careful with this step you will save yourself a lot time and trouble from NOT downloading an incompatible distribution. -Once that is done download the necessary files. The twelve (12) -mandatory files for all installations are listed below. If you have -not downloaded all of the files, the installer script will complain. +<bf>NOTE</bf>: the Xinstall.sh script must be downloaded in binary mode, +otherwise it won't run correctly. If you get lots of "command not found" +messages when you try to run it, then it is most likely because the +script wasn't downloaded in binary mode. Some web browsers won't do +this for files of that name, so we also have a copy of it called +"<tt>Xinstall.bin</tt>", and most browsers should download that correctly. +When downloading it under this name, select "save as" on your browser, +and save the file under the name "<tt>Xinstall.sh</tt>". + +Once you're run the <tt>Xinstall.sh</tt> script and found which binary +distribution is suitable for your system, download the necessary files. +The twelve (12) mandatory files for all installations are listed below. +If you have not downloaded all of the files, the installer script will +complain. <quote><verb> 1. Xinstall.sh The installer script diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml index cccfddb14..74f03321a 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml @@ -13,7 +13,7 @@ <date>30 June 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.106 2000/07/02 02:35:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.107 2000/07/02 16:35:56 dawes Exp $ </ident> <abstract> @@ -270,7 +270,7 @@ The contrib part of the distribution has been folded into the main source tree, so a separate contrib tarball is no longer required. To format the XFree86 documentation use the latest version of our doctools -package available as <tt>doctools-1.1.3.tgz</tt>. +package available as <tt>doctools-1.2.tgz</tt>. <sect>Reporting Bugs <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml index 8d0a43cc3..454076b3e 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml @@ -6,10 +6,10 @@ <title>Release Notes for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>30 June 2000 +<date>3 July 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.41 2000/07/02 02:35:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.42 2000/07/03 16:27:10 dawes Exp $ </ident> <abstract> @@ -25,32 +25,25 @@ in XFree86 &relvers; and their status. <p> XFree86 4.0 was the first official release of the new XFree86 4. XFree86 4 represents a significant redesign of the XFree86 X server. -Not all of the hardware drivers from 3.3.x have been ported to 4.x yet. - -<sect1>Differences Between the 4.x series and the 3.3 series -<p> -The 4.x release series is also missing -a nice configuration tool. -This means that configuring the Xserver might be trickier than usual. -The second point is that is that your hardware might not -be supported by &relvers;, or it -might be supported at a lesser level (conversely, some hardware is better -supported in &relvers;). We've attempted to provide some information +Not all of the hardware drivers from 3.3.x have been ported to 4.x yet, +but conversely, 4.x has some hardware support not present in 3.3.x. +We've attempted to provide some information about the second point in our <htmlurl name="Driver Status document" url="Status.html">. Please check there first before downloading &relvers;. -On the subject of configuration, we have updated the basic text-based -tool "<tt>xf86config</tt>" to generate config files in the format required -by &relvers; (3.3.x config files won't really work with &relvers;). We're also -working on some other configuration tools, including one that is built-in +The 4.0.1 has a new configuration tool, "<tt>xf86cfg</tt>". It is work +in progress, but definitely worth trying out. We have also updated the +basic text-based tool "<tt>xf86config</tt>" to generate config files in +the format required by &relvers; (3.3.x config files won't really work +with &relvers;). We're also on a configuration tool that is built-in to the X server. An early version of this is included in the release, and it works well for some hardware. To try it out, just run (as root) -"<tt>XFree86 -configure</tt>". Both of these configuration options will -give you a reasonable starting point for a suitable configuration -file. We've put some effort into documenting the &relvers; config file format, +"<tt>XFree86 -configure</tt>". Each of these configuration options will +give you a reasonable starting point for a suitable configuration file. +We've put some effort into documenting the &relvers; config file format, and you can find that information in the XF86Config manual page. Check -that, the driver manual pages and the related documentation for -further information. +that, the driver manual pages and the related documentation for further +information. Oh, another thing you might notice is that our documentation is rather patchy. Most of what is present should be in reasonable shape, but @@ -104,7 +97,41 @@ don't have enough space to cover it all here. <item>Add generic DGA support to the sis, neomagic and i810 drivers. - <item><tt>xf86cfg</tt>, a new graphical configuration tool. + <item><tt>xf86cfg</tt>, a new graphical configuration tool for XFree86 4.0, + and can be used to either write the initial configuration or make + customizations to the current configuration. <tt>xf86cfg</tt> is + a work in progress, and allows configuration of: + + <itemize> + <item>Specific setup of monitors, cards, keyboards and mice, as + well as adding or removing them. + <item>Server layout setup, allowing complex configuration of + physical monitor positions, default color depth and/or + rotated monitors. + <item>Mode line editor that can be used to configure multiple + monitors, and allows adding a modeline specific to a + monitor directly to the configuration file. + <item>AccessX configuration interface, that provides an interface + to easy setup of most AccessX options, including: + + <itemize> + <item>Timeout to reset controls. + <item>StickyKeys, for people with disabilities that cannot + press two keys at the same time. + <item>MouseKeys, mouse control only with the keyboard. + <item>RepeatKeys, repeat rate and repeat delay. + <item>SlowKeys, to avoid pressing keys accidentally, they're + only accepted if pressed for some specific amount + of time. + <item>BounceKeys, helps avoiding multiple key presses by + only accepting a key if it is pressed only once and + not pressed again in a specific amount of time. + </itemize> + </itemize> + + New configuration options are being worked on, as well as correcting + some of the bugs in the current options. A protocol for plugging + in external modules is also planned. </itemize> </sect1> @@ -441,7 +468,6 @@ Section "Device" Identifier "MGA 1" Driver "mga" BusID "PCI:1:0:0" - Option "PCI Retry" EndSection </verb></quote> @@ -675,19 +701,13 @@ Known problems: </itemize> -<sect1>XVideo extension -<p> - -The XVideo extension is included in this release, but nobody seems -interested in writing up some information about it. - <sect1>DGA version 2 <p> -DGA 2.0 is nearly completed but still not implemented by all drivers. +DGA 2.0 is included in &relvers;, but is not implemented by all drivers. Preliminary documentation for the client libraries can be found in the -xc/programs/Xserver/hw/xfree86/DGA document. Some degree of backwards -compatibility with version 1.0 is provided. This information is out of date. +<tt>README.DGA</tt> document. A good degree of backwards compatibility +with version 1.0 is provided. <sect1>DDC @@ -877,35 +897,29 @@ The MGA driver supports the same range or hardware as XFree86 3.3.4, but has a number of enhancements including multi-head support and support for (non-destructive) overlays (8-bit + 24-bit). -Option <tt>"overlay"</tt> when the server is started in 32bpp -(<tt>-fbbpp 32</tt>) will enable the 8+24 mode. The current -implementation doesn't optimize away unnecessary exposures yet so the -performance of this option will be better in future release. -By default, the color key for the overlays is 255, but this can be -changed with the <tt>"ColorKey"</tt> option to work around problems in -specific programs. Valid values for the key are 2-255. - This release contains performance enhancements for the G400 and particularly for the G400 MAX. It also includes XvImage support for G200/G400 chips and improved memory autodetection support. - -Further information can be found in the <tt>mga</tt> man page. +Further information can be found in the <tt>mga</tt> <htmlurl name="man page" +url="mga.4.html">. <sect2>ATI <p> Information about the ATI driver can be found in <url name="README.ati" -url="ati.html">. The current version is not accelerated. Acceleration -support is planned for a future release. +url="ati.html">. The current version is not accelerated for all supported +chips. Some acceleration is included for Mach64 chips. <sect2>NVIDIA <p> -The "nv" driver supports all Riva TNT accelerators as well as the -new GeForce and Quadro accelerators. DGA 2.0 support is included. +The "nv" driver supports all Riva TNT accelerators as well as the GeForce +256 and Quadro accelerators (the GeForce2 and GeForce2 MX are not yet +supported). DGA 2.0 support is included. -Further information can be found in the nv man page. +Further information can be found in the nv <htmlurl name="man page" +url="nv.4.html">. <sect2>Glide <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml index 38439e234..74985a30c 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml @@ -6,10 +6,10 @@ <title>Driver Status for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>3 March 2000 +<date>11 August 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.17 2000/06/19 15:00:54 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.18 2000/08/11 21:12:49 dawes Exp $ </ident> <abstract> @@ -153,8 +153,7 @@ dependencies/limitations, other architectures known to work on Support for the AL2101, ALI2228, ALI2301, ALI2302, ALI2308, ALI2401 chipsets. Support is provided by the XF86_SVGA server, using the al2101 driver for the AL2101, and the ali driver for - the others. The status of this support is unknown because we - don't have any recent test reports, and these drivers have no + the others. These drivers reportedly work, but they have no maintainer. <tag>&relvers;:</tag> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml index 662b6d744..9212b1d0c 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml @@ -8,10 +8,14 @@ <title>ATI Adapters README file <author>Marc Aurele La France -<date>2000 June 15 +<date>2000 August 3 + + + + <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.31 2000/06/19 15:00:54 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.33 2000/08/09 02:19:23 tsi Exp $ </ident> <abstract> @@ -83,7 +87,7 @@ VGAWonder series: 18800, 18800-1, 28800-2, 28800-4, 28800-5, 28800-6 3D Rage Mobility (including the -M and -P variants)</verb> The driver also supports 32K, 64K and 16M-colour modes on the 264xT and 3D Rage series of adapters using the accelerator CRTC (but not the VGA CRTC).<p> -The newer Rage 128 chips are not yet supported by this driver. +The newer Rage 128 and Radeon chips are not yet supported by this driver. Rage 128's are, however, supported by a separate driver, and Rage 128 owners should read the r128 driver's documentation for details.<p> Adapters based on the above chips have been marketed under a rather large @@ -135,9 +139,12 @@ on 88800 controllers, if the accelerator CRTC is used. XF86Config options are available to disable this aperture, or (for non-PCI adapters) enable it or move it to some other address.<p> By default, the driver provides some acceleration for Mach64 if the accelerator -CRTC is used. +CRTC is used, and modes whose colour depth greater than or equal to 8 are to be +used. This support is as yet incomplete and can be disabled entirely with an XF86Config option.<p> +On non-Intel platforms, the driver can, currently, only support PCI Mach64 +adapters.<p> <sect>Current implementation of generic VGA support for non-ATI adapters<p> Support for generic VGA with non-ATI adapters is also implemented, but has undergone only limited testing. @@ -145,7 +152,7 @@ The driver will intentionally disallow the use of this support with ATI adapters. This support must be explicitly requested through an XF86Config ChipSet specification. -This prevents the current generic driver from being disabled.<p> +This prevents the current VGA generic driver from being disabled.<p> This driver's generic VGA support is intended as an extension of that provided by the current generic driver. Specifically, within the architectural bounds defined by IBM's VGA standard, @@ -212,6 +219,8 @@ appropriate, will force the driver to probe for the non-PCI adapter. These ChipSet names should, therefore, only be used when there is in fact such an adapter in the system. They are otherwise equivalent to ``<it>ati</it>''.<p> +On non-Intel platforms, only ``<it>ati</it>'' and ``<it>mach64</it>'' ChipSet +values are operative.<p> <sect1>ChipID & ChipRev specifications<p> These specifications will cause the driver to associate the ``Device'' section only with an adapter having the same attributes, or an adapter whose PCI device @@ -348,7 +357,8 @@ ICS 2494-AM clock generators (found on some Dell motherboards): 18.750 19.375 20.000 22.500 6.294 7.081 7.875 9.000 25.000 27.500 31.500 33.750 10.000 11.225 12.500 16.250</verb> VGAWonder VLB, VGA 1024 VLB, Mach32 and Mach64 owners should only specify up to -the first 32 frequencies.<p> +the first 32 frequencies. +Any more will be ignored.<p> Other clock generators that have been used on ATI adapters (which can all be said to be clones of one of the above) might generate non-zero frequencies for those that are zero above, or vice-versa.<p> @@ -366,11 +376,9 @@ Any more will be ignored.<p> <sect1>Option <it>``crt_screen''</it><p> This specification is only effective when the driver detects that the adapter's BIOS has initialised both the digital flat panel and CRT interfaces. -In such a situation, the driver will normally drive the panel and disable the -CRT. +In such a situation, the driver will normally drive both the panel and the CRT. This specification causes the driver to disable the digital flat panel and -display the screen image on the CRT instead. -This specification will be reworked in the near future.<p> +display the screen image on the CRT instead.<p> <sect1>Option <it>``noaccel''</it><p> By default, the driver will accelerate draw operations if a Mach64 CRTC is used to drive the display. @@ -382,6 +390,8 @@ By default, the driver will enable a linear video memory aperture for 256-colour and higher depth modes if it is also using a Mach64 accelerator CRTC or an integrated Mach64 graphics chip. This option disables this linear aperture.<p> +On non-Intel platforms, the driver requires a linear aperture and, so, this +option should not be specified.<p> <sect1>Option <it>``shadowfb''</it><p> 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 @@ -416,6 +426,25 @@ For PCI and AGP adapters, this address is determined at system bootup according to the PCI Plug'n'Play specification which arbitrates the resource requirements of most devices in the system. This means the driver can not easily change the linear aperture address.<p> +<sect1>Option <it>``ReferenceClock''</it> ``frequency''<p> +This option is only applicable to non-Intel platforms, where an adapter BIOS is +not available to the driver. +The option specifies the reference frequency used by the adapter's clock +generator. +The default is 14.318 MHz, and other typical values are 28.636, or 29.5 MHz.<p> +<sect1>ClockChip <it>``name''</it><p> +This option is only applicable to non-Intel platforms, where an adapter BIOS is +not available to the driver, and the driver cannot reliably determine whether +the clock generator the adapter uses is a variant of an ATI 18818 (a.k.a. +ICS 2595) or an unsupported clock generator. +The only values that are acted upon are <it>``ATI 18818-0''</it> or +<it>``ATI 18818-1''</it>. +From this specification, the driver derives a reference divider of 43 or 46 +(respectively) for use in clock programming calculations. +The driver's default behaviour, in this case, is to assume an unsupported clock +generator, which means it will treat it as a fixed-frequency clock generator, +as described under the heading <bf>``Clocks for unsupported programmable clock +generators''</bf> above.<p> <sect>Video modes<p> Mode timings can be derived from the information in XFree86's doc subdirectory. However, it is no longer required to specify such timings in an XF86Config's @@ -570,4 +599,6 @@ This is the version found in XFree86 3.3.2, 3.3.3, 3.3.3.1, 3.3.3.2, 3.3.4, 3.3.5 and 3.3.6.<p> Version 5 is an almost complete restructuring of version 4 to fit in the newer driver API of XFree86 4.0 and later.<p> +The introduction of version 6 is a first swipe at porting the driver to +non-Intel architectures.<p> </article> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile index 79bdb9fb3..305988042 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.15 2000/06/19 15:00:55 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.17 2000/08/04 21:07:12 tsi Exp $ XCOMM XCOMM Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca XCOMM @@ -33,17 +33,59 @@ ATIMODSRC = atimodule.c ATIMODOBJ = atimodule.o #endif -SRCS = ati.c atiadapter.c atiadjust.c atibank.c atibios.c atibus.c atichip.c \ - aticlock.c aticonsole.c atidac.c atidga.c atidsp.c atiident.c atiio.c \ - atilock.c atimach64.c $(ATIMODSRC) atioption.c atipreinit.c atiprint.c \ - atiprobe.c atiscreen.c atiutil.c ativalid.c ativga.c atividmem.c \ - atiwonder.c +/* + * The following configuration logic is only meant as a first cut, and is + * therefore incomplete. ...And, no, you do NOT have permission to move this + * into xfree86.cf... + * + * Currently, ATIAvoidCPIO >MUST< be #define'd as YES for those platforms + * (architecture/OS combinations) that neither provide nor emulate a + * little-endian undirected PIO address space of at least 64 kB in size. + * + * "Undirected" means the driver does not need to determine the identity nor + * location of the responding adapter before accessing a particular location in + * the PIO address space. + * + * #define'ing ATIAvoidCPIO to YES generates a driver that will only support + * PCI/AGP Mach64 adapters using a linear aperture and the accelerator CRTC. + * The resulting driver will also require the same of the environment on server + * entry. + * + * For testing purposes, #define'ing ATIAvoidCPIO as YES is also supported on + * platforms that do, in fact, provide or emulate a PIO address space as + * described above, but this should not be the default driver configuration. + */ +#if defined(i386Architecture) || defined(ia64Architecture) +# ifndef ATIAvoidCPIO +# define ATIAvoidCPIO NO +# endif +#else +# undef ATIAvoidCPIO /* Clobber any previous setting */ +# define ATIAvoidCPIO YES +#endif + +#if !ATIAvoidCPIO + +CPIOSRCS = atibank.c atibios.c atiio.c ativga.c atiwonder.c +CPIOOBJS = atibank.o atibios.o atiio.o ativga.o atiwonder.o + +#else + +DEFINES = -DAVOID_CPIO + +#endif + +SRCS = ati.c atiadapter.c atiadjust.c atibus.c atichip.c aticlock.c \ + aticonsole.c atidac.c atidga.c atidsp.c atiident.c atilock.c \ + atimach64.c atimach64io.c $(ATIMODSRC) atioption.c atipreinit.c \ + atiprint.c atiprobe.c atiscreen.c atiutil.c ativalid.c atividmem.c \ + $(CPIOSRCS) -OBJS = ati.o atiadapter.o atiadjust.o atibank.o atibios.o atibus.o atichip.o \ - aticlock.o aticonsole.o atidac.o atidga.o atidsp.o atiident.o atiio.o \ - atilock.o atimach64.o $(ATIMODOBJ) atioption.o atipreinit.o atiprint.o \ - atiprobe.o atiscreen.o atiutil.o ativalid.o ativga.o atividmem.o \ - atiwonder.o +OBJS = ati.o atiadapter.o atiadjust.o atibus.o atichip.o aticlock.o \ + aticonsole.o atidac.o atidga.o atidsp.o atiident.o atilock.o \ + atimach64.o atimach64io.o $(ATIMODOBJ) atioption.o atipreinit.o \ + atiprint.o atiprobe.o atiscreen.o atiutil.o ativalid.o atividmem.o \ + $(CPIOOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -109,6 +151,8 @@ InstallDriverSDKNonExecFile(atilock.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atilock.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atimach64.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atimach64.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atimach64io.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atimach64io.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atimodule.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atimodule.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atimono.h,$(DRIVERSDKDIR)/drivers/ati) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c index ed9c0315c..d655859d3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.12 2000/05/11 18:14:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.13 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -60,6 +60,11 @@ * Mark Vojkovich, mvojkovich@valinux.com * Huw D M Davies, h.davies1@physics.ox.ac.uk * Andrew C Aitchison, A.C.Aitchison@dpmms.cam.ac.uk + * Ani Joshi, ajoshi@shell.unixbox.com + * Kostas Gewrgiou, gewrgiou@imbc.gr + * Jakub Jelinek, jakub@redhat.com + * David S. Miller, davem@redhat.com + * A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk * * ... and, many, many others from around the world. * diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h index ce4264699..3959dcf24 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.5 2000/02/18 12:19:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.6 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -32,8 +32,6 @@ #include "xf86_ansic.h" #include "xf86_OSproc.h" -#define ATI_README "\n See README.ati for details.\n" - extern DriverRec ATI; #endif /* ___ATI_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c index 64a104356..3540c74f1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.12 2000/06/19 15:00:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.13 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,8 +26,8 @@ #include "atichip.h" #include "atidac.h" #include "atidsp.h" -#include "atiio.h" #include "atimach64.h" +#include "atimach64io.h" #include "atiprint.h" #include "ativga.h" #include "atiwonder.h" @@ -38,6 +38,9 @@ const char *ATIAdapterNames[] = { "Unknown", + +#ifndef AVOID_CPIO + "ATI EGA Wonder800", "ATI EGA Wonder800+", "IBM VGA or compatible", @@ -51,10 +54,16 @@ const char *ATIAdapterNames[] = "IBM 8514/A or compatible", "ATI Mach8", "ATI Mach32", + +#endif /* AVOID_CPIO */ + "ATI Mach64", - "ATI Rage128" + "ATI Rage128", + "ATI Radeon" }; +#ifndef AVOID_CPIO + /* * ATICopyVGAMemory -- * @@ -89,10 +98,10 @@ ATICopyVGAMemory static void ATISwap ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI, - ATIHWPtr pATIHW, - Bool ToFB + int iScreen, + ATIPtr pATI, + ATIHWPtr pATIHW, + Bool ToFB ) { pointer save, *from, *to; @@ -125,7 +134,7 @@ ATISwap (pointer)xalloc(pATIHW->nBank * pATIHW->nPlane * 0x00010000U); if (!pATIHW->frame_buffer) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + xf86DrvMsg(iScreen, X_WARNING, "Temporary frame buffer could not be allocated.\n"); return; } @@ -245,6 +254,8 @@ ATISwap } } +#endif /* AVOID_CPIO */ + /* * ATIAdapterPreInit -- * @@ -262,6 +273,8 @@ ATIAdapterPreInit CARD32 lcd_index; int HDisplay, VDisplay; +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { /* Fill in VGA data */ @@ -274,7 +287,12 @@ ATIAdapterPreInit /* Fill in Mach64 data */ if (pATI->Chip >= ATI_CHIP_88800GXC) + +#endif /* AVOID_CPIO */ + + { ATIMach64PreInit(pScreenInfo, pATI, pATIHW); + } if (pATI->Chip >= ATI_CHIP_264CT) { @@ -301,24 +319,24 @@ ATIAdapterPreInit { if (pATI->Chip == ATI_CHIP_264LT) { - pATIHW->horz_stretching = inl(pATI->CPIO_HORZ_STRETCHING); - pATIHW->vert_stretching = inl(pATI->CPIO_VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + pATIHW->horz_stretching = inr(HORZ_STRETCHING); + pATIHW->vert_stretching = inr(VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - lcd_index = inl(pATI->CPIO_LCD_INDEX); + lcd_index = inr(LCD_INDEX); pATIHW->lcd_index = (lcd_index & ~(LCD_REG_INDEX | LCD_DISPLAY_DIS | LCD_SRC_SEL)) | (LCD_SRC_SEL_CRTC1 | LCD_CRTC2_DISPLAY_DIS); pATIHW->config_panel = - ATIGetLTProLCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; - pATIHW->lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); - pATIHW->horz_stretching = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING); - pATIHW->vert_stretching = ATIGetLTProLCDReg(LCD_VERT_STRETCHING); - outl(pATI->CPIO_LCD_INDEX, lcd_index); + ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); + pATIHW->vert_stretching = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); + outr(LCD_INDEX, lcd_index); } pATIHW->lcd_gen_ctrl &= @@ -347,16 +365,18 @@ ATIAdapterPreInit * the registers read here are not the ones actually in use by the * panel. */ - if (inl(pATI->CPIO_CRTC_GEN_CNTL) & CRTC_EXT_DISP_EN) + +#ifndef AVOID_CPIO + + if (pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN) + +#endif /* AVOID_CPIO */ + { - pATIHW->crtc_h_total_disp = - inl(pATI->CPIO_CRTC_H_TOTAL_DISP); - pATIHW->crtc_h_sync_strt_wid = - inl(pATI->CPIO_CRTC_H_SYNC_STRT_WID); - pATIHW->crtc_v_total_disp = - inl(pATI->CPIO_CRTC_V_TOTAL_DISP); - pATIHW->crtc_v_sync_strt_wid = - inl(pATI->CPIO_CRTC_V_SYNC_STRT_WID); + pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP); + pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); + pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP); + pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP); VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP); @@ -370,15 +390,20 @@ ATIAdapterPreInit pATI->LCDHSyncWidth = GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_WID); pATI->LCDHBlankWidth = - GetBits(pATIHW->crtc_h_total_disp, CRTC_H_TOTAL) - HDisplay; + GetBits(pATIHW->crtc_h_total_disp, CRTC_H_TOTAL) - + HDisplay; pATI->LCDVSyncStart = GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_STRT) - VDisplay; pATI->LCDVSyncWidth = GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_WID); pATI->LCDVBlankWidth = - GetBits(pATIHW->crtc_v_total_disp, CRTC_V_TOTAL) - VDisplay; + GetBits(pATIHW->crtc_v_total_disp, CRTC_V_TOTAL) - + VDisplay; } + +#ifndef AVOID_CPIO + else { pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U); @@ -397,7 +422,8 @@ ATIAdapterPreInit pATIHW->crt[18]) + 1; pATI->LCDHSyncStart = pATIHW->crt[4] - HDisplay; - pATI->LCDHSyncWidth = (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; + pATI->LCDHSyncWidth = + (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; pATI->LCDHBlankWidth = pATIHW->crt[0] + 5 - HDisplay; pATI->LCDVSyncStart = (((pATIHW->crt[7] << 2) & 0x0200U) | ((pATIHW->crt[7] << 6) & 0x0100U) | @@ -409,6 +435,8 @@ ATIAdapterPreInit pATIHW->crt[6]) + 2 - VDisplay; } +#endif /* AVOID_CPIO */ + HDisplay <<= 3; pATI->LCDHSyncStart <<= 3; pATI->LCDHSyncWidth <<= 3; @@ -456,11 +484,16 @@ ATIAdapterSave ATIHWPtr pATIHW ) { + +#ifndef AVOID_CPIO + int Index; /* Get bank to bank 0 */ (*pATIHW->SetBank)(pATI, 0); +#endif /* AVOID_CPIO */ + /* Save clock data */ ATIClockSave(pScreenInfo, pATI, pATIHW); @@ -483,31 +516,34 @@ ATIAdapterSave { if (pATI->Chip == ATI_CHIP_264LT) { - pATIHW->horz_stretching = inl(pATI->CPIO_HORZ_STRETCHING); - pATIHW->vert_stretching = inl(pATI->CPIO_VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + pATIHW->horz_stretching = inr(HORZ_STRETCHING); + pATIHW->vert_stretching = inr(VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); /* Set up to save non-shadow registers */ - outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - pATIHW->lcd_index = inl(pATI->CPIO_LCD_INDEX); - pATIHW->config_panel = ATIGetLTProLCDReg(LCD_CONFIG_PANEL); - pATIHW->lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); - pATIHW->horz_stretching = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING); - pATIHW->vert_stretching = ATIGetLTProLCDReg(LCD_VERT_STRETCHING); - pATIHW->ext_vert_stretch = ATIGetLTProLCDReg(LCD_EXT_VERT_STRETCH); + pATIHW->lcd_index = inr(LCD_INDEX); + pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL); + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); + pATIHW->vert_stretching = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); + pATIHW->ext_vert_stretch = + ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); /* Set up to save non-shadow registers */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); } } +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { /* Save VGA data */ @@ -520,10 +556,15 @@ ATIAdapterSave /* Save Mach64 data */ if (pATI->Chip >= ATI_CHIP_88800GXC) + +#endif /* AVOID_CPIO */ + + { ATIMach64Save(pATI, pATIHW); + } /* Save DSP data */ - if ((pATI->Chip >= ATI_CHIP_264VTB) && (pATI->CPIODecoding == BLOCK_IO)) + if (pATI->Chip >= ATI_CHIP_264VTB) ATIDSPSave(pATI, pATIHW); if (pATI->LCDPanelID >= 0) @@ -532,42 +573,45 @@ ATIAdapterSave { /* Switch to shadow registers */ if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, - (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | + outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); +#ifndef AVOID_CPIO + /* Save shadow VGA CRTC registers */ for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++) pATIHW->shadow_vga[Index] = GetReg(CRTX(pATI->CPIO_VGABase), Index); +#endif /* AVOID_CPIO */ + /* Save shadow Mach64 CRTC registers */ - pATIHW->shadow_h_total_disp = inl(pATI->CPIO_CRTC_H_TOTAL_DISP); - pATIHW->shadow_h_sync_strt_wid = - inl(pATI->CPIO_CRTC_H_SYNC_STRT_WID); - pATIHW->shadow_v_total_disp = inl(pATI->CPIO_CRTC_V_TOTAL_DISP); - pATIHW->shadow_v_sync_strt_wid = - inl(pATI->CPIO_CRTC_V_SYNC_STRT_WID); + pATIHW->shadow_h_total_disp = inr(CRTC_H_TOTAL_DISP); + pATIHW->shadow_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); + pATIHW->shadow_v_total_disp = inr(CRTC_V_TOTAL_DISP); + pATIHW->shadow_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); } /* Restore CRTC selection and shadow state */ if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); - outl(pATI->CPIO_LCD_INDEX, pATIHW->lcd_index); + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); + outr(LCD_INDEX, pATIHW->lcd_index); } } +#ifndef AVOID_CPIO + /* * For some unknown reason, CLKDIV2 needs to be turned off to save the * DAC's LUT reliably on VGA Wonder VLB adapters. @@ -575,12 +619,18 @@ ATIAdapterSave if ((pATI->Adapter == ATI_ADAPTER_NONISA) && (pATIHW->seq[1] & 0x08U)) PutReg(SEQX, 0x01U, pATIHW->seq[1] & ~0x08U); +#endif /* AVOID_CPIO */ + /* Save RAMDAC state */ ATIDACSave(pATI, pATIHW); +#ifndef AVOID_CPIO + if ((pATI->Adapter == ATI_ADAPTER_NONISA) && (pATIHW->seq[1] & 0x08U)) PutReg(SEQX, 0x01U, pATIHW->seq[1]); +#endif /* AVOID_CPIO */ + /* * The server has already saved video memory contents when switching out of * its virtual console, so don't do it again. @@ -589,11 +639,22 @@ ATIAdapterSave { pATIHW->FeedbackDivider = 0; /* Don't programme clock */ - ATISwap(pScreenInfo, pATI, pATIHW, FALSE); /* Save video memory */ +#ifndef AVOID_CPIO + + /* Save video memory */ + ATISwap(pScreenInfo->scrnIndex, pATI, pATIHW, FALSE); + +#endif /* AVOID_CPIO */ + } +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) ATIVGASaveScreen(pATI, SCREEN_SAVER_OFF); /* Turn on screen */ + +#endif /* AVOID_CPIO */ + } /* @@ -606,7 +667,7 @@ ATIAdapterSave Bool ATIAdapterCalculate ( - ScrnInfoPtr pScreenInfo, + int iScreen, ATIPtr pATI, ATIHWPtr pATIHW, DisplayModePtr pMode @@ -632,12 +693,17 @@ ATIAdapterCalculate VScan = pATI->LCDVertical / pMode->VDisplay; switch (pATIHW->crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: if (VScan > 64) VScan = 64; pMode->VScan = VScan; break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: pMode->VScan = 0; if (VScan <= 1) @@ -664,6 +730,9 @@ ATIAdapterCalculate switch (pATIHW->crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: /* Fill in VGA data */ ATIVGACalculate(pATI, pATIHW, pMode); @@ -702,7 +771,7 @@ ATIAdapterCalculate pATIHW->crtc_v_sync_strt_wid |= CRTC_V_SYNC_POL; } - pATIHW->crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL) & + pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL) & ~(CRTC_DBL_SCAN_EN | CRTC_INTERLACE_EN | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | CRTC_CSYNC_EN | CRTC_PIX_BY_2_EN | CRTC_DISPLAY_DIS | @@ -728,6 +797,8 @@ ATIAdapterCalculate } break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: /* Fill in Mach64 data */ ATIMach64Calculate(pATI, pATIHW, pMode); @@ -750,15 +821,15 @@ ATIAdapterCalculate VDisplay >>= 1; if (pATI->Chip == ATI_CHIP_264LT) - pATIHW->horz_stretching = inl(pATI->CPIO_HORZ_STRETCHING); + pATIHW->horz_stretching = inr(HORZ_STRETCHING); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - lcd_index = inl(pATI->CPIO_LCD_INDEX); - pATIHW->horz_stretching = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING); + lcd_index = inr(LCD_INDEX); + pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); pATIHW->ext_vert_stretch = - ATIGetLTProLCDReg(LCD_EXT_VERT_STRETCH) & + ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH) & ~(AUTO_VERT_RATIO | VERT_STRETCH_MODE); /* @@ -770,7 +841,7 @@ ATIAdapterCalculate (VDisplay < pATI->LCDVertical)) pATIHW->ext_vert_stretch |= VERT_STRETCH_MODE; - outl(pATI->CPIO_LCD_INDEX, lcd_index); + outr(LCD_INDEX, lcd_index); } pATIHW->horz_stretching &= @@ -793,10 +864,15 @@ ATIAdapterCalculate if (!pATI->OptionCRT) { + +#ifndef AVOID_CPIO + /* Copy non-shadow CRTC register values to the shadow set */ for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++) pATIHW->shadow_vga[Index] = pATIHW->crt[Index]; +#endif /* AVOID_CPIO */ + pATIHW->shadow_h_total_disp = pATIHW->crtc_h_total_disp; pATIHW->shadow_h_sync_strt_wid = pATIHW->crtc_h_sync_strt_wid; pATIHW->shadow_v_total_disp = pATIHW->crtc_v_total_disp; @@ -805,7 +881,7 @@ ATIAdapterCalculate } /* Fill in clock data */ - if (!ATIClockCalculate(pScreenInfo, pATI, pATIHW, pMode)) + if (!ATIClockCalculate(iScreen, pATI, pATIHW, pMode)) return FALSE; /* Setup ECP clock divider */ @@ -836,11 +912,16 @@ ATIAdapterSet ATIHWPtr pATIHW ) { + +#ifndef AVOID_CPIO + int Index; /* Get back to bank 0 */ (*pATIHW->SetBank)(pATI, 0); +#endif /* AVOID_CPIO */ + if (pATI->Chip >= ATI_CHIP_264CT) { ATIPutMach64PLLReg(PLL_VCLK_CNTL, pATIHW->pll_vclk_cntl); @@ -860,20 +941,20 @@ ATIAdapterSet if (pATI->LCDPanelID >= 0) { /* Stop CRTC */ - outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & ~(CRTC_EXT_DISP_EN | CRTC_EN)); if (pATI->Chip == ATI_CHIP_264LT) { /* Update non-shadow registers first */ - outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); /* Temporarily disable stretching */ - outl(pATI->CPIO_HORZ_STRETCHING, pATIHW->horz_stretching & + outr(HORZ_STRETCHING, pATIHW->horz_stretching & ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - outl(pATI->CPIO_VERT_STRETCHING, pATIHW->vert_stretching & + outr(VERT_STRETCHING, pATIHW->vert_stretching & ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | VERT_STRETCH_USE0 | VERT_STRETCH_EN)); } @@ -882,15 +963,15 @@ ATIAdapterSet (pATI->Chip == ATI_CHIP_MOBILITY)) */ { /* Update non-shadow registers first */ - ATIPutLTProLCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel); - ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & + ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel); + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); /* Temporarily disable stretching */ - ATIPutLTProLCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching & + ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching & ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - ATIPutLTProLCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching & + ATIPutMach64LCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching & ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | VERT_STRETCH_USE0 | VERT_STRETCH_EN)); } @@ -898,18 +979,20 @@ ATIAdapterSet switch (pATIHW->crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: /* Stop CRTC */ if (pATI->Chip >= ATI_CHIP_88800GXC) - outl(pATI->CPIO_CRTC_GEN_CNTL, - pATIHW->crtc_gen_cntl & ~CRTC_EN); + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & ~CRTC_EN); /* Start sequencer reset */ PutReg(SEQX, 0x00U, 0x00U); /* Set pixel clock */ if ((pATIHW->FeedbackDivider > 0) && - (pATI->ProgrammableClock != ATI_CLOCK_FIXED)) + (pATI->ProgrammableClock > ATI_CLOCK_FIXED)) ATIClockSet(pATI, pATIHW); /* Load VGA Wonder */ @@ -922,32 +1005,32 @@ ATIAdapterSet /* Load Mach64 registers */ if (pATI->Chip >= ATI_CHIP_88800GXC) { - outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); - outl(pATI->CPIO_MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); - outl(pATI->CPIO_MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); - outl(pATI->CPIO_CONFIG_CNTL, pATIHW->config_cntl); + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); + outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); + outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); + outr(CONFIG_CNTL, pATIHW->config_cntl); if (pATI->Chip >= ATI_CHIP_264CT) { - outl(pATI->CPIO_CRTC_H_TOTAL_DISP, - pATIHW->crtc_h_total_disp); - outl(pATI->CPIO_CRTC_H_SYNC_STRT_WID, - pATIHW->crtc_h_sync_strt_wid); - outl(pATI->CPIO_CRTC_V_TOTAL_DISP, - pATIHW->crtc_v_total_disp); - outl(pATI->CPIO_CRTC_V_SYNC_STRT_WID, - pATIHW->crtc_v_sync_strt_wid); - outl(pATI->CPIO_CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); - outl(pATI->CPIO_BUS_CNTL, pATIHW->bus_cntl); - outl(pATI->CPIO_DAC_CNTL, pATIHW->dac_cntl); + outr(CRTC_H_TOTAL_DISP, pATIHW->crtc_h_total_disp); + outr(CRTC_H_SYNC_STRT_WID, pATIHW->crtc_h_sync_strt_wid); + outr(CRTC_V_TOTAL_DISP, pATIHW->crtc_v_total_disp); + outr(CRTC_V_SYNC_STRT_WID, pATIHW->crtc_v_sync_strt_wid); + outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); + outr(BUS_CNTL, pATIHW->bus_cntl); + outr(DAC_CNTL, pATIHW->dac_cntl); } } break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: /* Load Mach64 CRTC registers */ ATIMach64Set(pATI, pATIHW); +#ifndef AVOID_CPIO + if (pATI->UseSmallApertures) { /* Oddly enough, these need to be set also, maybe others */ @@ -958,6 +1041,8 @@ ATIAdapterSet ATIModifyExtReg(pATI, 0xB6U, -1, 0x00U, pATIHW->b6); } +#endif /* AVOID_CPIO */ + break; default: @@ -971,14 +1056,13 @@ ATIAdapterSet { /* Switch to shadow registers */ if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, - (pATIHW->lcd_gen_ctrl & + outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | (SHADOW_EN | SHADOW_RW_EN)); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, (pATIHW->lcd_gen_ctrl & ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | (SHADOW_EN | SHADOW_RW_EN)); @@ -986,6 +1070,9 @@ ATIAdapterSet /* Restore shadow registers */ switch (pATIHW->crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); @@ -994,15 +1081,13 @@ ATIAdapterSet pATIHW->shadow_vga[Index]); /* Fall through */ +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: - outl(pATI->CPIO_CRTC_H_TOTAL_DISP, - pATIHW->shadow_h_total_disp); - outl(pATI->CPIO_CRTC_H_SYNC_STRT_WID, - pATIHW->shadow_h_sync_strt_wid); - outl(pATI->CPIO_CRTC_V_TOTAL_DISP, - pATIHW->shadow_v_total_disp); - outl(pATI->CPIO_CRTC_V_SYNC_STRT_WID, - pATIHW->shadow_v_sync_strt_wid); + outr(CRTC_H_TOTAL_DISP, pATIHW->shadow_h_total_disp); + outr(CRTC_H_SYNC_STRT_WID, pATIHW->shadow_h_sync_strt_wid); + outr(CRTC_V_TOTAL_DISP, pATIHW->shadow_v_total_disp); + outr(CRTC_V_SYNC_STRT_WID, pATIHW->shadow_v_sync_strt_wid); break; default: @@ -1013,19 +1098,19 @@ ATIAdapterSet /* Restore CRTC selection & shadow state and enable stretching */ if (pATI->Chip == ATI_CHIP_264LT) { - outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); - outl(pATI->CPIO_HORZ_STRETCHING, pATIHW->horz_stretching); - outl(pATI->CPIO_VERT_STRETCHING, pATIHW->vert_stretching); + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); + outr(HORZ_STRETCHING, pATIHW->horz_stretching); + outr(VERT_STRETCHING, pATIHW->vert_stretching); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); - ATIPutLTProLCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching); - ATIPutLTProLCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching); - ATIPutLTProLCDReg(LCD_EXT_VERT_STRETCH, pATIHW->ext_vert_stretch); - outl(pATI->CPIO_LCD_INDEX, pATIHW->lcd_index); + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching); + ATIPutMach64LCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching); + ATIPutMach64LCDReg(LCD_EXT_VERT_STRETCH, pATIHW->ext_vert_stretch); + outr(LCD_INDEX, pATIHW->lcd_index); } } @@ -1033,18 +1118,22 @@ ATIAdapterSet * Set DSP registers. Note that, for some reason, sequencer resets clear * the DSP_CONFIG register on early integrated controllers. */ - if ((pATI->Chip >= ATI_CHIP_264VTB) && (pATI->CPIODecoding == BLOCK_IO)) + if (pATI->Chip >= ATI_CHIP_264VTB) ATIDSPSet(pATI, pATIHW); /* Load RAMDAC */ ATIDACSet(pATI, pATIHW); +#ifndef AVOID_CPIO + /* Restore video memory */ - ATISwap(pScreenInfo, pATI, pATIHW, TRUE); + ATISwap(pScreenInfo->scrnIndex, pATI, pATIHW, TRUE); if (pATI->VGAAdapter != ATI_ADAPTER_NONE) ATIVGASaveScreen(pATI, SCREEN_SAVER_OFF); /* Turn on screen */ +#endif /* AVOID_CPIO */ + if ((xf86GetVerbosity() > 3) && (pATIHW == &pATI->NewHW)) { xf86ErrorFVerb(4, "\n After setting mode \"%s\":\n\n", diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h index f616c35e4..e206c2a88 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.5 2000/02/18 12:19:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.6 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" /* @@ -34,6 +35,9 @@ typedef enum { ATI_ADAPTER_NONE = 0, + +#ifndef AVOID_CPIO + ATI_ADAPTER_EGA, ATI_ADAPTER_EGA_PLUS, ATI_ADAPTER_VGA, @@ -47,8 +51,12 @@ typedef enum ATI_ADAPTER_8514A, ATI_ADAPTER_MACH8, ATI_ADAPTER_MACH32, + +#endif /* AVOID_CPIO */ + ATI_ADAPTER_MACH64, ATI_ADAPTER_RAGE128, + ATI_ADAPTER_RADEON, ATI_ADAPTER_MAX /* Must be last */ } ATIAdapterType; @@ -58,8 +66,8 @@ extern void ATIAdapterPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); extern void ATIAdapterSave FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); -extern Bool ATIAdapterCalculate FunctionPrototype((ScrnInfoPtr, ATIPtr, - ATIHWPtr, DisplayModePtr)); +extern Bool ATIAdapterCalculate FunctionPrototype((int, ATIPtr, ATIHWPtr, + DisplayModePtr)); extern void ATIAdapterSet FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c index 5b94998a0..78b199bfb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.6 2000/06/19 15:00:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.8 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,12 +21,12 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "ati.h" #include "atiadjust.h" #include "atichip.h" #include "aticrtc.h" -#include "atiio.h" #include "atilock.h" -#include "xf86.h" +#include "atimach64io.h" /* * The display start address is expressed in units of 32-bit (VGA) or 64-bit @@ -50,6 +50,8 @@ ATIAdjustPreInit { unsigned long MaxBase; +#ifndef AVOID_CPIO + if ((pATI->CPIO_VGAWonder) && (pATI->Chip <= ATI_CHIP_18800_1) && (pATI->VideoRAM == 256) && @@ -60,6 +62,9 @@ ATIAdjustPreInit pATI->AdjustMask = (unsigned long)(-32); } else + +#endif /* AVOID_CPIO */ + { pATI->AdjustDepth = (pATI->bitsPerPixel + 7) >> 3; @@ -73,6 +78,9 @@ ATIAdjustPreInit switch (pATI->NewHW.crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: if (pATI->Chip >= ATI_CHIP_264CT) { @@ -88,6 +96,8 @@ ATIAdjustPreInit pATI->AdjustMaxBase = 0x0FFFFFU << 3; break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: pATI->AdjustMaxBase = MaxBits(CRTC_OFFSET) << 3; break; @@ -141,6 +151,8 @@ ATIAdjustFrame /* Unlock registers */ ATIUnlock(pATI); +#ifndef AVOID_CPIO + if ((pATI->NewHW.crtc == ATI_CRTC_VGA) && (pATI->Chip < ATI_CHIP_264CT)) { PutReg(CRTX(pATI->CPIO_VGABase), 0x0CU, GetByte(Base, 1)); @@ -165,6 +177,9 @@ ATIAdjustFrame } } else + +#endif /* AVOID_CPIO */ + { /* * On integrated controllers, there is only one set of CRTC control @@ -173,19 +188,29 @@ ATIAdjustFrame * setting the CRTC's offset register to more than 256k needs to be * done through the accelerator port. */ + +#ifndef AVOID_CPIO + if (pATI->depth <= 4) { - outl(pATI->CPIO_CRTC_OFF_PITCH, - SetBits(pATI->displayWidth >> 4, CRTC_PITCH) | - SetBits(Base, CRTC_OFFSET)); + outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 4, CRTC_PITCH) | + SetBits(Base, CRTC_OFFSET)); } else + +#endif /* AVOID_CPIO */ + { + +#ifndef AVOID_CPIO + if (pATI->NewHW.crtc == ATI_CRTC_VGA) Base <<= 1; /* LSBit must be zero */ - outl(pATI->CPIO_CRTC_OFF_PITCH, - SetBits(pATI->displayWidth >> 3, CRTC_PITCH) | - SetBits(Base, CRTC_OFFSET)); + +#endif /* AVOID_CPIO */ + + outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 3, CRTC_PITCH) | + SetBits(Base, CRTC_OFFSET)); } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c index 64d175c11..9ba4c2832 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.6 2000/03/22 03:08:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.8 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,9 +21,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "ati.h" #include "atibank.h" -#include "atiio.h" -#include "xf86.h" +#include "atimach64io.h" + +#ifndef AVOID_CPIO /* * ATI VGA Wonder V3 adapters use an ATI 18800 chip and are single-banked. @@ -266,8 +268,9 @@ ATIMach64SetBankPacked ) { CARD32 tmp = ATIMach64MassagePackedBankNumber(iBank); - outl(pATI->CPIO_MEM_VGA_RP_SEL, tmp); - outl(pATI->CPIO_MEM_VGA_WP_SEL, tmp); + + outr(MEM_VGA_RP_SEL, tmp); + outr(MEM_VGA_WP_SEL, tmp); } /* @@ -282,8 +285,9 @@ ATIMach64SetReadPacked unsigned int iBank ) { - outl(ATIPTR(XF86SCRNINFO(pScreen))->CPIO_MEM_VGA_RP_SEL, - ATIMach64MassagePackedBankNumber(iBank)); + ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); + + outr(MEM_VGA_RP_SEL, ATIMach64MassagePackedBankNumber(iBank)); return 0; } @@ -299,8 +303,9 @@ ATIMach64SetWritePacked unsigned int iBank ) { - outl(ATIPTR(XF86SCRNINFO(pScreen))->CPIO_MEM_VGA_WP_SEL, - ATIMach64MassagePackedBankNumber(iBank)); + ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); + + outr(MEM_VGA_WP_SEL, ATIMach64MassagePackedBankNumber(iBank)); return 0; } @@ -343,8 +348,9 @@ ATIMach64SetBankPlanar ) { CARD32 tmp = ATIMach64MassagePlanarBankNumber(iBank); - outl(pATI->CPIO_MEM_VGA_RP_SEL, tmp); - outl(pATI->CPIO_MEM_VGA_WP_SEL, tmp); + + outr(MEM_VGA_RP_SEL, tmp); + outr(MEM_VGA_WP_SEL, tmp); } /* @@ -359,8 +365,9 @@ ATIMach64SetReadPlanar unsigned int iBank ) { - outl(ATIPTR(XF86SCRNINFO(pScreen))->CPIO_MEM_VGA_RP_SEL, - ATIMach64MassagePlanarBankNumber(iBank)); + ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); + + outr(MEM_VGA_RP_SEL, ATIMach64MassagePlanarBankNumber(iBank)); return 0; } @@ -376,8 +383,9 @@ ATIMach64SetWritePlanar unsigned int iBank ) { - outl(ATIPTR(XF86SCRNINFO(pScreen))->CPIO_MEM_VGA_WP_SEL, - ATIMach64MassagePlanarBankNumber(iBank)); + ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); + + outr(MEM_VGA_WP_SEL, ATIMach64MassagePlanarBankNumber(iBank)); return 0; } @@ -396,3 +404,5 @@ ATIMach64SetReadWritePlanar ATIMach64SetBankPlanar(ATIPTR(XF86SCRNINFO(pScreen)), iBank); return 0; } + +#endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h index 1473c31bb..5922386ab 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.4 2000/02/18 12:19:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.5 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,8 +26,11 @@ #include "atipriv.h" #include "atiproto.h" + #include "mibank.h" +#ifndef AVOID_CPIO + /* * Banking definitions. */ @@ -80,4 +83,6 @@ extern ATIBankProc ATIV3SetBank, ATIMach64SetBankPacked, ATIMach64SetBankPlanar; +#endif /* AVOID_CPIO */ + #endif /* ___ATIBANK_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c index 3ca1adc95..c543d519b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c,v 1.5 2000/02/18 12:19:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c,v 1.6 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,8 @@ #include "atibios.h" #include "atistruct.h" +#ifndef AVOID_CPIO + /* * ATIReadBIOS -- * @@ -47,7 +49,7 @@ ATIReadBIOS * disabled on server entry. */ if ((pVideo = pATI->PCIInfo) && - (((pPCI = (pciConfigPtr)(pVideo->thisCard))->pci_command & + (((pPCI = pVideo->thisCard)->pci_command & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)) != (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) @@ -61,3 +63,5 @@ ATIReadBIOS pATI->BIOSBase = 0x000C0000U; return xf86ReadBIOS(pATI->BIOSBase, Offset, Buffer, Length); } + +#endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h index 43fd902ac..24f6b0d2b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h,v 1.2 2000/02/18 12:19:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h,v 1.3 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,9 +26,14 @@ #include "atipriv.h" #include "atiproto.h" + #include "Xmd.h" +#ifndef AVOID_CPIO + extern int ATIReadBIOS FunctionPrototype((ATIPtr, pointer, unsigned long, int)); +#endif /* AVOID_CPIO */ + #endif /* ___ATIBIOS_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c index 0d44a5c0d..93fcd7b14 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.8 2000/05/03 00:44:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.9 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -46,6 +46,28 @@ const char *ATIBusNames[] = }; /* + * ATIRefreshPCIBases -- + * + * This function ensures the common layer's view of an adapter's PCI resources + * is up-to-date. This should eventually be moved into the common layer. + */ +void +ATIRefreshPCIBases +( + pciVideoPtr pVideo, + pciConfigPtr pPCI +) +{ + pPCI->pci_base0 = pciReadLong(pPCI->tag, PCI_CMD_BASE_REG + 0); + pPCI->pci_base1 = pciReadLong(pPCI->tag, PCI_CMD_BASE_REG + 4); + pPCI->pci_base2 = pciReadLong(pPCI->tag, PCI_CMD_BASE_REG + 8); + + pVideo->memBase[0] = PCIGETMEMORY(pPCI->pci_base0); + pVideo->ioBase[1] = PCIGETIO(pPCI->pci_base1); + pVideo->memBase[2] = PCIGETMEMORY(pPCI->pci_base2); +} + +/* * ATIClaimResources -- * * This function registers most of the bus resources used by an adapter. The @@ -62,6 +84,9 @@ ATIClaimResources ) { resPtr pResources; + +#ifndef AVOID_CPIO + resRange Resources[2] = {{0, 0, 0}, _END}; /* Claim VGA and VGAWonder resources */ @@ -98,8 +123,13 @@ ATIClaimResources } } +#endif /* AVOID_CPIO */ + if (Active || !pATI->SharedAccelerator) { + +#ifndef AVOID_CPIO + /* Claim 8514/A resources */ if (pATI->ChipHasSUBSYS_CNTL) xf86ClaimFixedResources( @@ -120,6 +150,8 @@ ATIClaimResources xf86ClaimFixedResources(Resources, pATI->iEntity); } +#endif /* AVOID_CPIO */ + /* Register relocatable resources for inactive adapters */ if (!Active) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h index a5b1bdd9e..84b46e7a4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.5 2000/02/18 12:19:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.6 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -22,10 +22,17 @@ */ #ifndef ___ATIBUS_H___ + +#if !defined(___ATI_H___) && defined(XFree86Module) +# error missing #include "ati.h" before #include "atibus.h" +# undef XFree86Module +#endif + #define ___ATIBUS_H___ 1 #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" /* @@ -46,7 +53,8 @@ typedef enum extern const char *ATIBusNames[]; -extern int ATIClaimBusSlot FunctionPrototype((DriverPtr, int, GDevPtr, Bool, - ATIPtr)); +extern void ATIRefreshPCIBases FunctionPrototype((pciVideoPtr, pciConfigPtr)); +extern int ATIClaimBusSlot FunctionPrototype((DriverPtr, int, GDevPtr, + Bool, ATIPtr)); #endif /* ___ATIBUS_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c index c50cf1641..397e0bcaa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.11 2000/04/20 21:28:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.12 2000/08/04 21:07:12 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -24,7 +24,7 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" -#include "atiio.h" +#include "atimach64io.h" #include "ativersion.h" /* @@ -33,6 +33,9 @@ const char *ATIChipNames[] = { "Unknown", + +#ifndef AVOID_CPIO + "IBM VGA or compatible", "ATI 18800", "ATI 18800-1", @@ -48,6 +51,9 @@ const char *ATIChipNames[] = "ATI 68800-6", "ATI 68800LX", "ATI 68800AX", + +#endif /* AVOID_CPIO */ + "ATI 88800GX-C", "ATI 88800GX-D", "ATI 88800GX-E", @@ -79,6 +85,8 @@ const char *ATIChipNames[] = const char *ATIFoundryNames[] = { "SGS", "NEC", "KCS", "UMC", "TSMC", "5", "6", "UMC" }; +#ifndef AVOID_CPIO + /* * ATIMach32ChipID -- * @@ -121,6 +129,8 @@ ATIMach32ChipID } } +#endif /* AVOID_CPIO */ + /* * ATIMach64ChipID -- * @@ -134,13 +144,13 @@ ATIMach64ChipID const CARD16 ExpectedChipType ) { - CARD32 IOValue = inl(ATIIOPort(CONFIG_CHIP_ID)); - pATI->ChipType = GetBits(IOValue, 0xFFFFU); - pATI->ChipClass = GetBits(IOValue, CFG_CHIP_CLASS); - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REV); - pATI->ChipVersion = GetBits(IOValue, CFG_CHIP_VERSION); - pATI->ChipFoundry = GetBits(IOValue, CFG_CHIP_FOUNDRY); - pATI->ChipRev = pATI->ChipRevision; + pATI->config_chip_id = inr(CONFIG_CHIP_ID); + pATI->ChipType = GetBits(pATI->config_chip_id, 0xFFFFU); + pATI->ChipClass = GetBits(pATI->config_chip_id, CFG_CHIP_CLASS); + pATI->ChipRevision = GetBits(pATI->config_chip_id, CFG_CHIP_REV); + pATI->ChipVersion = GetBits(pATI->config_chip_id, CFG_CHIP_VERSION); + pATI->ChipFoundry = GetBits(pATI->config_chip_id, CFG_CHIP_FOUNDRY); + pATI->ChipRev = pATI->ChipRevision; switch (pATI->ChipType) { case OldChipID('G', 'X'): @@ -179,7 +189,8 @@ ATIMach64ChipID case OldChipID('C', 'T'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('C', 'T'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264CT; pATI->BusType = ATI_BUS_PCI; break; @@ -187,7 +198,8 @@ ATIMach64ChipID case OldChipID('E', 'T'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('E', 'T'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264ET; pATI->BusType = ATI_BUS_PCI; break; @@ -195,7 +207,8 @@ ATIMach64ChipID case OldChipID('V', 'T'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('V', 'T'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264VT; pATI->BusType = ATI_BUS_PCI; /* Some early GT's are detected as VT's */ @@ -216,7 +229,8 @@ ATIMach64ChipID case OldChipID('G', 'T'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'T'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->BusType = ATI_BUS_PCI; if (!pATI->ChipVersion) pATI->Chip = ATI_CHIP_264GT; @@ -227,7 +241,8 @@ ATIMach64ChipID case OldChipID('V', 'U'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('V', 'U'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264VT3; pATI->BusType = ATI_BUS_PCI; break; @@ -235,7 +250,8 @@ ATIMach64ChipID case OldChipID('G', 'U'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'U'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264GTDVD; pATI->BusType = ATI_BUS_PCI; break; @@ -243,7 +259,8 @@ ATIMach64ChipID case OldChipID('L', 'G'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'G'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264LT; pATI->BusType = ATI_BUS_PCI; break; @@ -251,7 +268,8 @@ ATIMach64ChipID case OldChipID('V', 'V'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('V', 'V'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264VT4; pATI->BusType = ATI_BUS_PCI; break; @@ -259,7 +277,8 @@ ATIMach64ChipID case OldChipID('G', 'V'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'V'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264GT2C; pATI->BusType = ATI_BUS_PCI; break; @@ -269,7 +288,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'W'): case NewChipID('G', 'Z'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264GT2C; pATI->BusType = ATI_BUS_AGP; break; @@ -281,7 +301,8 @@ ATIMach64ChipID case NewChipID('G', 'I'): case NewChipID('G', 'P'): case NewChipID('G', 'Q'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264GTPRO; pATI->BusType = ATI_BUS_PCI; break; @@ -291,7 +312,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'B'): case NewChipID('G', 'D'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264GTPRO; pATI->BusType = ATI_BUS_AGP; break; @@ -301,7 +323,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'I'): case NewChipID('L', 'P'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264LTPRO; pATI->BusType = ATI_BUS_PCI; pATI->LCDVBlendFIFOSize = 800; @@ -312,7 +335,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'B'): case NewChipID('L', 'D'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264LTPRO; pATI->BusType = ATI_BUS_AGP; pATI->LCDVBlendFIFOSize = 800; @@ -327,7 +351,8 @@ ATIMach64ChipID case NewChipID('G', 'O'): case NewChipID('G', 'R'): case NewChipID('G', 'S'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264XL; pATI->BusType = ATI_BUS_PCI; pATI->LCDVBlendFIFOSize = 1024; @@ -338,7 +363,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('G', 'M'): case NewChipID('G', 'N'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264XL; pATI->BusType = ATI_BUS_AGP; pATI->LCDVBlendFIFOSize = 1024; @@ -349,7 +375,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'R'): case NewChipID('L', 'S'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_MOBILITY; pATI->BusType = ATI_BUS_PCI; pATI->LCDVBlendFIFOSize = 1024; @@ -360,7 +387,8 @@ ATIMach64ChipID pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'M'): case NewChipID('L', 'N'): - pATI->ChipRevision = GetBits(IOValue, CFG_CHIP_REVISION); + pATI->ChipRevision = + GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_MOBILITY; pATI->BusType = ATI_BUS_AGP; pATI->LCDVBlendFIFOSize = 1024; @@ -373,7 +401,7 @@ ATIMach64ChipID } /* - * ATIPCIChip -- + * ATIChipID -- * * This returns the ATI_CHIP_* value (generally) associated with a particular * ChipID/ChipRev combination. @@ -387,6 +415,9 @@ ATIChipID { switch (ChipID) { + +#ifndef AVOID_CPIO + case OldChipID('A', 'A'): case NewChipID('A', 'A'): return ATI_CHIP_68800_3; @@ -399,6 +430,8 @@ ATIChipID case OldChipID('A', 'X'): case NewChipID('A', 'X'): return ATI_CHIP_68800AX; +#endif /* AVOID_CPIO */ + case OldChipID('G', 'X'): case NewChipID('G', 'X'): switch (ChipRev) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h index 395602062..e548aa6a5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.10 2000/03/30 15:41:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.11 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiregs.h" + #include "Xmd.h" /* @@ -34,6 +35,9 @@ typedef enum { ATI_CHIP_NONE = 0, + +#ifndef AVOID_CPIO + ATI_CHIP_VGA, /* Generic VGA */ ATI_CHIP_18800, ATI_CHIP_18800_1, @@ -49,6 +53,9 @@ typedef enum ATI_CHIP_68800_6, /* Mach32 */ ATI_CHIP_68800LX, /* Mach32 */ ATI_CHIP_68800AX, /* Mach32 */ + +#endif /* AVOID_CPIO */ + ATI_CHIP_88800GXC, /* Mach64 */ ATI_CHIP_88800GXD, /* Mach64 */ ATI_CHIP_88800GXE, /* Mach64 */ @@ -96,7 +103,12 @@ typedef enum extern const char *ATIFoundryNames[]; +#ifndef AVOID_CPIO + extern void ATIMach32ChipID FunctionPrototype((ATIPtr)); + +#endif /* AVOID_CPIO */ + extern void ATIMach64ChipID FunctionPrototype((ATIPtr, const CARD16)); extern ATIChipType ATIChipID FunctionPrototype((const CARD16, const CARD8)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c index 5cd0604c2..23e682d3f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.10 2000/06/19 15:00:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.11 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -197,6 +197,7 @@ #include "atichip.h" #include "atidac.h" #include "atidsp.h" +#include "atimach64io.h" /* * Definitions related to non-programmable clock generators. @@ -241,7 +242,7 @@ ClockRec ATIClockDescriptors[] = "SGS-Thompson 1703 or similar" }, { - 8, 263, 8, 8, 9, + 16, 263, 8, 8, 9, 4, 12, 2, 4, ATIPostDividers, "Chrontel 8398 or similar" @@ -268,7 +269,7 @@ ClockRec ATIClockDescriptors[] = /* * XF86Config clocks line that start with the following will either be rejected - * for ATI boards, or accepted for non-ATI boards. + * for ATI adapters, or accepted for non-ATI adapters. */ static const int ATIVGAClocks[] = @@ -422,113 +423,6 @@ static const CARD8 ClockMaps[][4] = ((_Index) & ~0x0CU)) /* - * ATIClockSelect -- - * - * This function sets clock select bits in various registers to a specified - * value. - */ -static Bool -ATIClockSelect -( - ScrnInfoPtr pScreenInfo, - int Index -) -{ - ATIPtr pATI = ATIPTR(pScreenInfo); - CARD8 genmo; - - switch (Index) - { - case CLK_REG_SAVE: - if (pATI->CPIO_VGAWonder && (pATI->OldHW.crtc == ATI_CRTC_VGA)) - ATIModifyExtReg(pATI, 0xB5U, pATI->OldHW.b5, 0x7FU, 0x00U); - break; - - case CLK_REG_RESTORE: - break; - - default: - /* Remap clock number */ - Index = MapClockIndex(pATI->OldHW.ClockMap, Index); - - switch (pATI->OldHW.crtc) - { - case ATI_CRTC_VGA: - /* Get generic two low-order bits */ - genmo = (inb(R_GENMO) & 0xF3U) | ((Index << 2) & 0x0CU); - - if (pATI->CPIO_VGAWonder) - { - /* - * On adapters with crystals, switching to one of the - * spare assignments doesn't do anything (i.e. the - * previous setting remains in effect). So, disable - * their selection. - */ - if (((Index & 0x03U) == 0x02U) && - ((pATI->Chip <= ATI_CHIP_18800) || - (pATI->Adapter == ATI_ADAPTER_V4))) - return FALSE; - - /* Start sequencer reset */ - PutReg(SEQX, 0x00U, 0x00U); - - /* Set high-order bits */ - if (pATI->Chip <= ATI_CHIP_18800) - ATIModifyExtReg(pATI, 0xB2U, -1, 0xBFU, - Index << 4); - else - { - ATIModifyExtReg(pATI, 0xBEU, -1, 0xEFU, - Index << 2); - if (pATI->Adapter != ATI_ADAPTER_V4) - { - Index >>= 1; - ATIModifyExtReg(pATI, 0xB9U, -1, 0xFDU, - Index >> 1); - } - } - - /* Set clock divider bits */ - ATIModifyExtReg(pATI, 0xB8U, -1, 0x00U, - (Index << 3) & 0xC0U); - } - else - { - /* - * Reject clocks that cannot be selected. - */ - if (Index & ~0x03U) - return FALSE; - - /* Start sequencer reset */ - PutReg(SEQX, 0x00U, 0x00U); - } - - /* Must set miscellaneous output register last */ - outb(GENMO, genmo); - - /* End sequencer reset */ - PutReg(SEQX, 0x00U, 0x03U); - - break; - - case ATI_CRTC_MACH64: - outl(pATI->CPIO_CLOCK_CNTL, CLOCK_STROBE | - SetBits(Index, CLOCK_SELECT | CLOCK_DIVIDER)); - break; - - default: - return FALSE; - } - - break; - } - - return TRUE; -} - -/* * ATIMatchClockLine -- * * This function tries to match the XF86Config clocks to one of an array of @@ -550,9 +444,18 @@ ATIMatchClockLine int MinimumGap = CLOCK_TOLERANCE + 1; /* For ATI adapters, reject generic VGA clocks */ - if ((pATI->Adapter != ATI_ADAPTER_VGA) && - (ClockLine == SpecificationClockLine)) - ClockChipIndex++; + +#ifndef AVOID_CPIO + + if (pATI->Adapter != ATI_ADAPTER_VGA) + +#endif /* AVOID_CPIO */ + + { + if (ClockLine == SpecificationClockLine) + ClockChipIndex++; + } + /* If checking for XF86Config clock order, skip crystals */ if (ClockMap) ClockChipIndex++; @@ -561,11 +464,15 @@ ATIMatchClockLine { int MaximumGap = 0, ClockCount = 0, ClockIndex = 0; +#ifndef AVOID_CPIO + /* Only Mach64's and Rage128's can have programmable clocks */ if ((ClockChipIndex >= ATI_CLOCK_MACH64A) && (pATI->Adapter < ATI_ADAPTER_MACH64)) break; +#endif /* AVOID_CPIO */ + for (; ClockIndex < NumberOfClocks; ClockIndex++) { int Gap, XF86ConfigClock, SpecificationClock; @@ -601,10 +508,16 @@ ATIMatchClockLine if (!(MinimumGap = MaximumGap)) break; -SkipThisClockGenerator: +SkipThisClockGenerator:; + +#ifndef AVOID_CPIO + /* For non-ATI adapters, only normalise standard VGA clocks */ if (pATI->Adapter == ATI_ADAPTER_VGA) break; + +#endif /* AVOID_CPIO */ + } return ClockChip; @@ -625,12 +538,18 @@ ATIClockPreInit ClockRangePtr pRange ) { + double ScaleFactor; unsigned short int NumberOfUndividedClocks; unsigned short int NumberOfDividers, NumberOfClocks; int CalibrationClockNumber, CalibrationClockValue; - int ClockIndex, SpecificationClock, ClockMap = 0; - CARD16 VSyncRegister = GENS1(pATI->CPIO_VGABase); - CARD8 VSyncBit = 0x08U; + int ClockIndex, SpecificationClock, ClockMap = 0, Index; + CARD8 CanDisableInterrupts; + +#ifndef AVOID_CPIO + + CARD8 genmo; + +#endif /* AVOID_CPIO */ /* * Decide what to do about the XF86Config clocks for programmable clock @@ -639,7 +558,8 @@ ATIClockPreInit if (pATI->ProgrammableClock != ATI_CLOCK_FIXED) { /* Check for those that are not (yet) handled */ - if (pATI->ProgrammableClock > NumberOf(ATIClockDescriptors)) + if ((pATI->ProgrammableClock == ATI_CLOCK_UNKNOWN) || + (pATI->ProgrammableClock > NumberOf(ATIClockDescriptors))) xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_WARNING, 0, "Unknown programmable clock generator type (0x%02X)" " detected.\n", pATI->ProgrammableClock); @@ -658,12 +578,18 @@ ATIClockPreInit pScreenInfo->progClock = TRUE; /* Set internal clock ordering */ + +#ifndef AVOID_CPIO + if (pATI->NewHW.crtc == ATI_CRTC_VGA) { pATI->NewHW.ClockMap = ATIVGAProgrammableClockMap; pATI->NewHW.ClockUnmap = ATIVGAProgrammableClockUnmap; } else + +#endif /* AVOID_CPIO */ + { pATI->NewHW.ClockMap = ATIProgrammableClockMap; pATI->NewHW.ClockUnmap = ATIProgrammableClockUnmap; @@ -706,15 +632,22 @@ ATIClockPreInit } } +#ifndef AVOID_CPIO + /* Set default clock maps */ pATI->NewHW.ClockMap = ATIVGAWonderClockMap; pATI->NewHW.ClockUnmap = ATIVGAWonderClockUnmap; +#endif /* AVOID_CPIO */ + /* * Determine the number of clock values the adapter should be able to * generate and the dot clock to use for probe calibration. */ ProbeClocks: + +#ifndef AVOID_CPIO + if (pATI->Adapter == ATI_ADAPTER_VGA) { NumberOfDividers = 1; @@ -723,7 +656,13 @@ ProbeClocks: CalibrationClockValue = 28322; } else + +#endif /* AVOID_CPIO */ + { + +#ifndef AVOID_CPIO + NumberOfDividers = 4; if ((pATI->Chip <= ATI_CHIP_18800) || (pATI->Adapter == ATI_ADAPTER_V4)) @@ -734,11 +673,20 @@ ProbeClocks: CalibrationClockValue = 56644; } else + +#endif /* AVOID_CPIO */ + { NumberOfUndividedClocks = 16; + +#ifndef AVOID_CPIO + CalibrationClockNumber = 7; CalibrationClockValue = 36000; if (pATI->Chip >= ATI_CHIP_68800) + +#endif /* AVOID_CPIO */ + { NumberOfDividers = 2; if (pATI->Chip >= ATI_CHIP_264CT) @@ -748,7 +696,14 @@ ProbeClocks: CalibrationClockNumber = 1; CalibrationClockValue = 28322; } - else if (pATI->Adapter >= ATI_ADAPTER_MACH64) + else + +#ifndef AVOID_CPIO + + if (pATI->Adapter >= ATI_ADAPTER_MACH64) + +#endif /* AVOID_CPIO */ + { CalibrationClockNumber = 10 /* or 11 */; CalibrationClockValue = 75000 /* or 65000 */; @@ -758,12 +713,18 @@ ProbeClocks: * When selecting clocks, all ATI accelerators use a different * clock ordering. */ + +#ifndef AVOID_CPIO + if (pATI->NewHW.crtc == ATI_CRTC_VGA) { pATI->NewHW.ClockMap = ATIMachVGAClockMap; pATI->NewHW.ClockUnmap = ATIMachVGAClockUnmap; } else + +#endif /* AVOID_CPIO */ + { pATI->NewHW.ClockMap = ATIAcceleratorClockMap; pATI->NewHW.ClockUnmap = ATIAcceleratorClockUnmap; @@ -806,6 +767,8 @@ ProbeClocks: CalibrationClockValue *= 10; } +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { /* @@ -816,27 +779,208 @@ ProbeClocks: * greater than what the adapter can handle. */ ATIAdapterSave(pScreenInfo, pATI, &pATI->OldHW); + + /* Ensure clock select pins are not OR'ed with anything */ + if (pATI->CPIO_VGAWonder && (pATI->OldHW.crtc == ATI_CRTC_VGA)) + ATIModifyExtReg(pATI, 0xB5, pATI->OldHW.b5, 0x7FU, 0x00U); } - switch (pATI->OldHW.crtc) +#endif /* AVOID_CPIO */ + + /* + * Probe the adapter for clock values. The following is essentially + * the common layer's xf86GetClocks() reworked to fit. One difference + * is the ability to monitor a VSync bit in MMIO space. + */ + CanDisableInterrupts = TRUE; /* An assumption verified below */ + + for (ClockIndex = 0; ClockIndex < NumberOfClocks; ClockIndex++) { - case ATI_CRTC_VGA: - /* Already set */ - break; + pScreenInfo->clock[ClockIndex] = 0; - case ATI_CRTC_MACH64: - VSyncRegister = pATI->CPIO_CRTC_INT_CNTL; - VSyncBit = GetByte(CRTC_VBLANK, 0); - break; + /* Remap clock number */ + Index = MapClockIndex(pATI->OldHW.ClockMap, ClockIndex); - default: - break; + /* Select the clock */ + switch (pATI->OldHW.crtc) + { + +#ifndef AVOID_CPIO + + case ATI_CRTC_VGA: + /* Get generic two low-order bits */ + genmo = (inb(R_GENMO) & 0xF3U) | ((Index << 2) & 0x0CU); + + if (pATI->CPIO_VGAWonder) + { + /* + * On adapters with crystals, switching to one of the + * spare assignments doesn't do anything (i.e. the + * previous setting remains in effect). So, disable + * their selection. + */ + if (((Index & 0x03U) == 0x02U) && + ((pATI->Chip <= ATI_CHIP_18800) || + (pATI->Adapter == ATI_ADAPTER_V4))) + continue; + + /* Start sequencer reset */ + PutReg(SEQX, 0x00U, 0x00U); + + /* Set high-order bits */ + if (pATI->Chip <= ATI_CHIP_18800) + ATIModifyExtReg(pATI, 0xB2U, -1, 0xBFU, + Index << 4); + else + { + ATIModifyExtReg(pATI, 0xBEU, -1, 0xEFU, + Index << 2); + if (pATI->Adapter != ATI_ADAPTER_V4) + { + Index >>= 1; + ATIModifyExtReg(pATI, 0xB9U, -1, 0xFDU, + Index >> 1); + } + } + + /* Set clock divider bits */ + ATIModifyExtReg(pATI, 0xB8U, -1, 0x00U, + (Index << 3) & 0xC0U); + } + else + { + /* + * Reject clocks that cannot be selected. + */ + if (Index & ~0x03U) + continue; + + /* Start sequencer reset */ + PutReg(SEQX, 0x00U, 0x00U); + } + + /* Must set miscellaneous output register last */ + outb(GENMO, genmo); + + /* End sequencer reset */ + PutReg(SEQX, 0x00U, 0x03U); + + break; + +#endif /* AVOID_CPIO */ + + case ATI_CRTC_MACH64: + out8(CLOCK_CNTL, CLOCK_STROBE | + SetBits(Index, CLOCK_SELECT | CLOCK_DIVIDER)); + break; + + default: + continue; + } + + usleep(50000); /* Let clock stabilise */ + + xf86SetPriority(TRUE); + + /* Try to disable interrupts */ + if (CanDisableInterrupts && !xf86DisableInterrupts()) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to disable interrupts; Clock probe will not be as" + " accurate.\n"); + CanDisableInterrupts = FALSE; + } + + /* + * Generate a count while monitoring the vertical sync or blanking + * pulse. This is dependent on the CRTC used by the mode on server + * entry. + */ + switch (pATI->OldHW.crtc) + { + +#ifndef AVOID_CPIO + + case ATI_CRTC_VGA: + /* Verify vertical sync pulses are in fact occurring */ + Index = 1 << 19; + while (!(inb(GENS1(pATI->CPIO_VGABase)) & 0x08U)) + if (Index-- <= 0) + goto EnableInterrupts; + Index = 1 << 19; + while (inb(GENS1(pATI->CPIO_VGABase)) & 0x08U) + if (Index-- <= 0) + goto EnableInterrupts; + Index = 1 << 19; + while (!(inb(GENS1(pATI->CPIO_VGABase)) & 0x08U)) + if (Index-- <= 0) + goto EnableInterrupts; + + /* Generate the count */ + for (Index = 0; Index < 8; Index++) + { + while (inb(GENS1(pATI->CPIO_VGABase)) & 0x08U) + pScreenInfo->clock[ClockIndex]++; + while (!(inb(GENS1(pATI->CPIO_VGABase)) & 0x08U)) + pScreenInfo->clock[ClockIndex]++; + } + break; + +#endif /* AVOID_CPIO */ + + case ATI_CRTC_MACH64: + /* Verify vertical blanking pulses are in fact occurring */ + Index = 1 << 19; + while (!(inr(CRTC_INT_CNTL) & CRTC_VBLANK)) + if (Index-- <= 0) + goto EnableInterrupts; + Index = 1 << 19; + while (inr(CRTC_INT_CNTL) & CRTC_VBLANK) + if (Index-- <= 0) + goto EnableInterrupts; + Index = 1 << 19; + while (!(inr(CRTC_INT_CNTL) & CRTC_VBLANK)) + if (Index-- <= 0) + goto EnableInterrupts; + + /* Generate the count */ + for (Index = 0; Index < 4; Index++) + { + while (inr(CRTC_INT_CNTL) & CRTC_VBLANK) + pScreenInfo->clock[ClockIndex]++; + while (!(inr(CRTC_INT_CNTL) & CRTC_VBLANK)) + pScreenInfo->clock[ClockIndex]++; + } + break; + + default: + break; + } + + EnableInterrupts: + if (CanDisableInterrupts) + xf86EnableInterrupts(); + + xf86SetPriority(FALSE); } - /* Probe the adapter for clock values */ - xf86GetClocks(pScreenInfo, NumberOfClocks, ATIClockSelect, - NULL, NULL, VSyncRegister, VSyncBit, - CalibrationClockNumber, CalibrationClockValue); + ScaleFactor = (double)CalibrationClockValue * + (double)pScreenInfo->clock[CalibrationClockNumber]; + + /* Scale the clocks from counts to kHz */ + for (ClockIndex = 0; ClockIndex < NumberOfClocks; ClockIndex++) + { + if (ClockIndex == CalibrationClockNumber) + pScreenInfo->clock[ClockIndex] = CalibrationClockValue; + else /* Round to the nearest 10 kHz */ + pScreenInfo->clock[ClockIndex] = + (((ScaleFactor / (double)pScreenInfo->clock[ClockIndex]) + + 5) / 10) * 10; + } + + pScreenInfo->numClocks = NumberOfClocks; + +#ifndef AVOID_CPIO if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { @@ -846,6 +990,8 @@ ProbeClocks: pATI->OldHW.frame_buffer = NULL; } +#endif /* AVOID_CPIO */ + /* Tell user clocks were probed, instead of supplied */ pATI->OptionProbeClocks = TRUE; @@ -854,6 +1000,8 @@ ProbeClocks: SpecificationClockLine, NumberOfUndividedClocks, CalibrationClockNumber, 0); +#ifndef AVOID_CPIO + if ((pATI->Chip <= ATI_CHIP_18800) || (pATI->Adapter == ATI_ADAPTER_V4)) { @@ -862,6 +1010,8 @@ ProbeClocks: pATI->Clock = ATI_CLOCK_NONE; } else + +#endif /* AVOID_CPIO */ { /* All others don't have crystals */ if (pATI->Clock == ATI_CLOCK_CRYSTALS) @@ -890,21 +1040,32 @@ ProbeClocks: pATI->Clock = ATIMatchClockLine(pScreenInfo, pATI, SpecificationClockLine, NumberOfUndividedClocks, -1, 0); +#ifndef AVOID_CPIO + if (pATI->Adapter != ATI_ADAPTER_VGA) + +#endif /* AVOID_CPIO */ + { if (pATI->Clock == ATI_CLOCK_NONE) { /* * Reject certain clock lines that are obviously wrong. This - * includes the standard VGA clocks for non-ATI adapters, and - * clock lines that could have been used with the pre-2.1.1 - * driver. + * includes the standard VGA clocks for ATI adapters, and clock + * lines that could have been used with the pre-2.1.1 driver. */ if (ATIMatchClockLine(pScreenInfo, pATI, InvalidClockLine, NumberOfClocks, -1, 0)) pATI->OptionProbeClocks = TRUE; - else if ((pATI->Chip >= ATI_CHIP_18800) && - (pATI->Adapter != ATI_ADAPTER_V4)) + else + +#ifndef AVOID_CPIO + + if ((pATI->Chip >= ATI_CHIP_18800) && + (pATI->Adapter != ATI_ADAPTER_V4)) + +#endif /* AVOID_CPIO */ + { /* * Check for clocks that are specified in the wrong order. @@ -921,7 +1082,7 @@ ProbeClocks: xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_WARNING, 0, "XF86Config clock ordering incorrect. Clocks" - " will be reordered." ATI_README); + " will be reordered.\n"); break; } } @@ -929,6 +1090,9 @@ ProbeClocks: } else /* Ensure crystals are not matched to clock chips, and vice versa */ + +#ifndef AVOID_CPIO + if ((pATI->Chip <= ATI_CHIP_18800) || (pATI->Adapter == ATI_ADAPTER_V4)) { @@ -936,6 +1100,9 @@ ProbeClocks: pATI->OptionProbeClocks = TRUE; } else + +#endif /* AVOID_CPIO */ + { if (pATI->Clock == ATI_CLOCK_CRYSTALS) pATI->OptionProbeClocks = TRUE; @@ -945,7 +1112,7 @@ ProbeClocks: { xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_WARNING, 0, "Invalid or obsolete XF86Config clocks line rejected.\n" - " Clocks will be probed." ATI_README); + " Clocks will be probed.\n"); goto ProbeClocks; } } @@ -956,12 +1123,21 @@ ProbeClocks: else if (pATI->Clock == ATI_CLOCK_NONE) xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_WARNING, 0, "Unknown clock generator detected.\n"); - else if (pATI->Clock == ATI_CLOCK_CRYSTALS) + else + +#ifndef AVOID_CPIO + + if (pATI->Clock == ATI_CLOCK_CRYSTALS) xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "This adapter uses crystals to generate clock frequencies.\n"); else if (pATI->Clock != ATI_CLOCK_VGA) + +#endif /* AVOID_CPIO */ + + { xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s clock chip detected.\n", ATIClockNames[pATI->Clock]); + } if (pATI->Clock != ATI_CLOCK_NONE) { @@ -1037,14 +1213,20 @@ ATIClockSave ATIHWPtr pATIHW ) { - if (pScreenInfo->vtSema && (pATI->ProgrammableClock != ATI_CLOCK_FIXED)) + if (pScreenInfo->vtSema && (pATI->ProgrammableClock > ATI_CLOCK_FIXED)) { + +#ifndef AVOID_CPIO + if (pATIHW->crtc == ATI_CRTC_VGA) { pATIHW->ClockMap = ATIVGAProgrammableClockMap; pATIHW->ClockUnmap = ATIVGAProgrammableClockUnmap; } else + +#endif /* AVOID_CPIO */ + { pATIHW->ClockMap = ATIProgrammableClockMap; pATIHW->ClockUnmap = ATIProgrammableClockUnmap; @@ -1052,11 +1234,20 @@ ATIClockSave } else { + +#ifndef AVOID_CPIO + if (pATIHW->crtc != ATI_CRTC_VGA) + +#endif /* AVOID_CPIO */ + { pATIHW->ClockMap = ATIAcceleratorClockMap; pATIHW->ClockUnmap = ATIAcceleratorClockUnmap; } + +#ifndef AVOID_CPIO + else if (pATI->Chip < ATI_CHIP_68800) { pATIHW->ClockMap = ATIVGAWonderClockMap; @@ -1067,6 +1258,9 @@ ATIClockSave pATIHW->ClockMap = ATIMachVGAClockMap; pATIHW->ClockUnmap = ATIMachVGAClockUnmap; } + +#endif /* AVOID_CPIO */ + } } @@ -1079,7 +1273,7 @@ ATIClockSave Bool ATIClockCalculate ( - ScrnInfoPtr pScreenInfo, + int iScreen, ATIPtr pATI, ATIHWPtr pATIHW, DisplayModePtr pMode @@ -1092,7 +1286,7 @@ ATIClockCalculate /* Set default values */ pATIHW->FeedbackDivider = pATIHW->ReferenceDivider = pATIHW->PostDivider = 0; - if ((pATI->ProgrammableClock == ATI_CLOCK_FIXED) || + if ((pATI->ProgrammableClock <= ATI_CLOCK_FIXED) || ((pATI->ProgrammableClock == ATI_CLOCK_CH8398) && (pMode->ClockIndex < 2))) { @@ -1162,7 +1356,7 @@ ATIClockCalculate Frequency = ATIDivide(Frequency, Multiple, 0, 0); if (abs(Frequency - pMode->Clock) > CLOCK_TOLERANCE) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + xf86DrvMsg(iScreen, X_ERROR, "Unable to programme clock %.3fMHz for mode %s.\n", (double)(pMode->Clock) / 1000.0, pMode->name); return FALSE; @@ -1177,8 +1371,7 @@ ATIClockCalculate pATIHW->FeedbackDivider, pATIHW->ReferenceDivider, pATIHW->PostDivider); - if ((pATI->Chip >= ATI_CHIP_264VTB) && - (pATI->CPIODecoding == BLOCK_IO)) + if (pATI->Chip >= ATI_CHIP_264VTB) ATIDSPCalculate(pATI, pATIHW, pMode); } @@ -1188,6 +1381,9 @@ ATIClockCalculate switch (pATIHW->crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: pATIHW->genmo = (pATIHW->genmo & 0xF3U) | ((ClockSelect << 2) & 0x0CU); @@ -1216,6 +1412,8 @@ ATIClockCalculate } break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: pATIHW->clock_cntl = CLOCK_STROBE | SetBits(ClockSelect, CLOCK_SELECT | CLOCK_DIVIDER); @@ -1240,24 +1438,22 @@ ATIClockSet ATIHWPtr pATIHW ) { - CARD8 clock_cntl0, crtc_gen_cntl3; - CARD8 tmp, tmp2; + CARD32 crtc_gen_cntl, tmp; + CARD8 clock_cntl0; + CARD8 tmp2; unsigned int Programme; int N = pATIHW->FeedbackDivider - pATI->ClockDescriptor.NAdjust; int M = pATIHW->ReferenceDivider - pATI->ClockDescriptor.MAdjust; int D = pATIHW->PostDivider; /* Temporarily switch to accelerator mode */ - crtc_gen_cntl3 = inb(pATI->CPIO_CRTC_GEN_CNTL + 3); - outb(pATI->CPIO_CRTC_GEN_CNTL + 3, - crtc_gen_cntl3 | GetByte(CRTC_EXT_DISP_EN, 3)); - - ATISetDACIOPorts(pATI, ATI_CRTC_MACH64); + crtc_gen_cntl = inr(CRTC_GEN_CNTL); + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); switch (pATI->ProgrammableClock) { case ATI_CLOCK_ICS2595: - clock_cntl0 = inb(pATI->CPIO_CLOCK_CNTL); + clock_cntl0 = in8(CLOCK_CNTL); Programme = (SetBits(pATIHW->clock, ICS2595_CLOCK) | SetBits(N, ICS2595_FB_DIV) | SetBits(D, ICS2595_POST_DIV)) ^ @@ -1271,9 +1467,9 @@ ATIClockSet while (Programme >= CLOCK_BIT) { tmp = (Programme & CLOCK_BIT) | CLOCK_STROBE; - outb(pATI->CPIO_CLOCK_CNTL, tmp); + out8(CLOCK_CNTL, tmp); ATIDelay(26); /* 26 microseconds */ - outb(pATI->CPIO_CLOCK_CNTL, tmp | CLOCK_PULSE); + out8(CLOCK_CNTL, tmp | CLOCK_PULSE); ATIDelay(26); /* 26 microseconds */ Programme >>= 1; } @@ -1281,26 +1477,29 @@ ATIClockSet xf86EnableInterrupts(); /* Restore register */ - outb(pATI->CPIO_CLOCK_CNTL, clock_cntl0 | CLOCK_STROBE); + out8(CLOCK_CNTL, clock_cntl0 | CLOCK_STROBE); break; case ATI_CLOCK_STG1703: (void)ATIGetDACCmdReg(pATI); - (void)inb(pATI->CPIO_DAC_MASK); - outb(pATI->CPIO_DAC_MASK, (pATIHW->clock << 1) + 0x20U); - outb(pATI->CPIO_DAC_MASK, 0); - outb(pATI->CPIO_DAC_MASK, SetBits(N, 0xFFU)); - outb(pATI->CPIO_DAC_MASK, SetBits(M, 0x1FU) | SetBits(D, 0xE0U)); + (void)in8(M64_DAC_MASK); + out8(M64_DAC_MASK, (pATIHW->clock << 1) + 0x20U); + out8(M64_DAC_MASK, 0); + out8(M64_DAC_MASK, SetBits(N, 0xFFU)); + out8(M64_DAC_MASK, SetBits(M, 0x1FU) | SetBits(D, 0xE0U)); break; case ATI_CLOCK_CH8398: - tmp = inb(pATI->CPIO_DAC_CNTL); - outb(pATI->CPIO_DAC_CNTL, - tmp | (DAC_EXT_SEL_RS2 | DAC_EXT_SEL_RS3)); - outb(pATI->CPIO_DAC_WRITE, pATIHW->clock); - outb(pATI->CPIO_DAC_DATA, SetBits(N, 0xFFU)); - outb(pATI->CPIO_DAC_DATA, SetBits(M, 0x3FU) | SetBits(D, 0xC0U)); - outb(pATI->CPIO_DAC_CNTL, tmp); + tmp = inr(DAC_CNTL) | (DAC_EXT_SEL_RS2 | DAC_EXT_SEL_RS3); + outr(DAC_CNTL, tmp); + out8(M64_DAC_WRITE, pATIHW->clock); + out8(M64_DAC_DATA, SetBits(N, 0xFFU)); + out8(M64_DAC_DATA, SetBits(M, 0x3FU) | SetBits(D, 0xC0U)); + out8(M64_DAC_MASK, 0x04U); + outr(DAC_CNTL, tmp & ~(DAC_EXT_SEL_RS2 | DAC_EXT_SEL_RS3)); + tmp2 = in8(M64_DAC_WRITE); + out8(M64_DAC_WRITE, (tmp2 & 0x70U) | 0x80U); + outr(DAC_CNTL, tmp & ~DAC_EXT_SEL_RS2); break; case ATI_CLOCK_INTERNAL: @@ -1334,45 +1533,44 @@ ATIClockSet case ATI_CLOCK_ATT20C408: (void)ATIGetDACCmdReg(pATI); - tmp = inb(pATI->CPIO_DAC_MASK); + tmp = in8(M64_DAC_MASK); (void)ATIGetDACCmdReg(pATI); - outb(pATI->CPIO_DAC_MASK, tmp | 1); - outb(pATI->CPIO_DAC_WRITE, 1); - outb(pATI->CPIO_DAC_MASK, tmp | 9); + out8(M64_DAC_MASK, tmp | 1); + out8(M64_DAC_WRITE, 1); + out8(M64_DAC_MASK, tmp | 9); ATIDelay(400); /* 400 microseconds */ tmp2 = (pATIHW->clock << 2) + 0x40U; - outb(pATI->CPIO_DAC_WRITE, tmp2); - outb(pATI->CPIO_DAC_MASK, SetBits(N, 0xFFU)); - outb(pATI->CPIO_DAC_WRITE, ++tmp2); - outb(pATI->CPIO_DAC_MASK, SetBits(M, 0x3FU) | SetBits(D, 0xC0U)); - outb(pATI->CPIO_DAC_WRITE, ++tmp2); - outb(pATI->CPIO_DAC_MASK, 0x77U); + out8(M64_DAC_WRITE, tmp2); + out8(M64_DAC_MASK, SetBits(N, 0xFFU)); + out8(M64_DAC_WRITE, ++tmp2); + out8(M64_DAC_MASK, SetBits(M, 0x3FU) | SetBits(D, 0xC0U)); + out8(M64_DAC_WRITE, ++tmp2); + out8(M64_DAC_MASK, 0x77U); ATIDelay(400); /* 400 microseconds */ - outb(pATI->CPIO_DAC_WRITE, 1); - outb(pATI->CPIO_DAC_MASK, tmp); + out8(M64_DAC_WRITE, 1); + out8(M64_DAC_MASK, tmp); break; case ATI_CLOCK_IBMRGB514: - tmp = inb(pATI->CPIO_DAC_CNTL); - outb(pATI->CPIO_DAC_CNTL, - (tmp & ~DAC_EXT_SEL_RS3) | DAC_EXT_SEL_RS2); + tmp = inr(DAC_CNTL); + outr(DAC_CNTL, (tmp & ~DAC_EXT_SEL_RS3) | DAC_EXT_SEL_RS2); tmp2 = (pATIHW->clock << 1) + 0x20U; - outb(pATI->CPIO_DAC_WRITE, tmp2); - outb(pATI->CPIO_DAC_DATA, 0); - outb(pATI->CPIO_DAC_MASK, + out8(M64_DAC_WRITE, tmp2); + out8(M64_DAC_DATA, 0); + out8(M64_DAC_MASK, (SetBits(N, 0x3FU) | SetBits(D, 0xC0U)) ^ 0xC0U); - outb(pATI->CPIO_DAC_WRITE, tmp2 + 1); - outb(pATI->CPIO_DAC_DATA, 0); - outb(pATI->CPIO_DAC_MASK, SetBits(M, 0x3FU)); - outb(pATI->CPIO_DAC_CNTL, tmp); + out8(M64_DAC_WRITE, tmp2 + 1); + out8(M64_DAC_DATA, 0); + out8(M64_DAC_MASK, SetBits(M, 0x3FU)); + outr(DAC_CNTL, tmp); break; default: break; } - (void)inb(pATI->CPIO_DAC_WRITE); /* Clear DAC counter */ + (void)in8(M64_DAC_WRITE); /* Clear DAC counter */ /* Restore register */ - outb(pATI->CPIO_CRTC_GEN_CNTL + 3, crtc_gen_cntl3); + outr(CRTC_GEN_CNTL, crtc_gen_cntl); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h index 7378afa83..8c4485ad3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.4 2000/02/18 12:19:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.5 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" /* @@ -51,6 +52,7 @@ extern const char *ATIClockNames[]; */ typedef enum { + ATI_CLOCK_UNKNOWN = -1, ATI_CLOCK_FIXED = 0, /* Further described by ATIClockType */ ATI_CLOCK_ICS2595, ATI_CLOCK_STG1703, @@ -77,8 +79,8 @@ extern void ATIClockPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, GDevPtr, ClockRangePtr)); extern void ATIClockSave FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); -extern Bool ATIClockCalculate FunctionPrototype((ScrnInfoPtr, ATIPtr, - ATIHWPtr, DisplayModePtr)); +extern Bool ATIClockCalculate FunctionPrototype((int, ATIPtr, ATIHWPtr, + DisplayModePtr)); extern void ATIClockSet FunctionPrototype((ATIPtr, ATIHWPtr)); #endif /* ___ATICLOCK_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c index c0682036f..82e0a24a1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.12 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.13 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -29,6 +29,7 @@ #include "atistruct.h" #include "ativga.h" #include "atividmem.h" + #include "xf86.h" /* @@ -59,10 +60,15 @@ ATISaveScreen pATI = ATIPTR(pScreenInfo); switch (pATI->NewHW.crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: ATIVGASaveScreen(pATI, Mode); break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: ATIMach64SaveScreen(pATI, Mode); break; @@ -101,13 +107,23 @@ ATISetDPMSMode ATIMach64SetDPMSMode(pATI, DPMSMode); break; +#ifndef AVOID_CPIO + case ATI_ADAPTER_NONE: case ATI_ADAPTER_8514A: case ATI_ADAPTER_MACH8: break; +#endif /* AVOID_CPIO */ + default: /* Assume EGA/VGA */ + +#ifndef AVOID_CPIO + ATIVGASetDPMSMode(pATI, DPMSMode); + +#endif /* AVOID_CPIO */ + break; } } @@ -126,7 +142,7 @@ ATIEnterGraphics ) { /* Map apertures */ - if (!ATIMapApertures(pScreenInfo, pATI)) + if (!ATIMapApertures(pScreenInfo->scrnIndex, pATI)) return FALSE; /* Unlock device */ @@ -134,7 +150,7 @@ ATIEnterGraphics /* Calculate hardware data */ if (pScreen && - !ATIAdapterCalculate(pScreenInfo, pATI, &pATI->NewHW, + !ATIAdapterCalculate(pScreenInfo->scrnIndex, pATI, &pATI->NewHW, pScreenInfo->currentMode)) return FALSE; @@ -188,7 +204,7 @@ ATILeaveGraphics /* Unmap apertures */ if (!pATI->Closeable || !pATI->nDGAMode) - ATIUnmapApertures(pScreenInfo, pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); SetTimeSinceLastInputEvent(); } @@ -210,7 +226,7 @@ ATISwitchMode ATIPtr pATI = ATIPTR(pScreenInfo); /* Calculate new hardware data */ - if (!ATIAdapterCalculate(pScreenInfo, pATI, &pATI->NewHW, pMode)) + if (!ATIAdapterCalculate(iScreen, pATI, &pATI->NewHW, pMode)) return FALSE; /* Set new hardware state */ @@ -251,10 +267,14 @@ ATIEnterVT if (pATI->OptionShadowFB) return TRUE; +#ifndef AVOID_CPIO + /* If used, modify banking interface */ if (!miModifyBanking(pScreen, &pATI->BankInfo)) return FALSE; +#endif /* AVOID_CPIO */ + pScreenPixmap = (*pScreen->GetScreenPixmap)(pScreen); PixmapPrivate = pScreenPixmap->devPrivate; if (!PixmapPrivate.ptr) @@ -312,9 +332,13 @@ ATIFreeScreen ATILeaveGraphics(pScreenInfo, pATI); +#ifndef AVOID_CPIO + xfree(pATI->OldHW.frame_buffer); xfree(pATI->NewHW.frame_buffer); +#endif /* AVOID_CPIO */ + xfree(pATI->pShadow); xfree(pATI->pDGAMode); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h index 11d6e96c7..fb33e324c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.5 2000/03/22 03:08:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.6 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" extern Bool ATISaveScreen FunctionPrototype((ScreenPtr, int)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h index 218bb80e2..b6d91e9df 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.4 2000/02/18 12:19:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.5 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -29,8 +29,14 @@ */ typedef enum { + +#ifndef AVOID_CPIO + ATI_CRTC_VGA, /* Use VGA CRTC */ ATI_CRTC_8514, /* Use 8514/Mach8/Mach32 accelerator CRTC */ + +#endif /* AVOID_CPIO */ + ATI_CRTC_MACH64 /* Use Mach64 accelerator CRTC */ } ATICRTCType; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c index aaf65b95f..68a32983e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.8 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.9 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,7 +21,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "ati.h" #include "atidac.h" +#include "atimach64io.h" #include "atimono.h" /* @@ -55,6 +57,8 @@ const DACRec ATIDACDescriptors[] = {ATI_DAC_UNKNOWN, "Unknown"} /* Must be last */ }; +#ifndef AVOID_CPIO + /* * ATISetDACIOPorts -- * @@ -77,17 +81,17 @@ ATISetDACIOPorts break; case ATI_CRTC_8514: - pATI->CPIO_DAC_DATA = DAC_DATA; - pATI->CPIO_DAC_MASK = DAC_MASK; - pATI->CPIO_DAC_READ = DAC_R_INDEX; - pATI->CPIO_DAC_WRITE = DAC_W_INDEX; + pATI->CPIO_DAC_DATA = IBM_DAC_DATA; + pATI->CPIO_DAC_MASK = IBM_DAC_MASK; + pATI->CPIO_DAC_READ = IBM_DAC_READ; + pATI->CPIO_DAC_WRITE = IBM_DAC_WRITE; break; case ATI_CRTC_MACH64: - pATI->CPIO_DAC_DATA = pATI->CPIO_DAC_REGS + 1; - pATI->CPIO_DAC_MASK = pATI->CPIO_DAC_REGS + 2; - pATI->CPIO_DAC_READ = pATI->CPIO_DAC_REGS + 3; - pATI->CPIO_DAC_WRITE = pATI->CPIO_DAC_REGS + 0; + pATI->CPIO_DAC_DATA = ATIIOPort(DAC_REGS) + 1; + pATI->CPIO_DAC_MASK = ATIIOPort(DAC_REGS) + 2; + pATI->CPIO_DAC_READ = ATIIOPort(DAC_REGS) + 3; + pATI->CPIO_DAC_WRITE = ATIIOPort(DAC_REGS) + 0; break; default: @@ -95,6 +99,8 @@ ATISetDACIOPorts } } +#endif /* AVOID_CPIO */ + /* * ATIGetDACCmdReg -- * @@ -106,11 +112,25 @@ ATIGetDACCmdReg ATIPtr pATI ) { + +#ifdef AVOID_CPIO + + (void)in8(M64_DAC_WRITE); /* Reset to PEL mode */ + (void)in8(M64_DAC_MASK); + (void)in8(M64_DAC_MASK); + (void)in8(M64_DAC_MASK); + return in8(M64_DAC_MASK); + +#else /* AVOID_CPIO */ + (void)inb(pATI->CPIO_DAC_WRITE); /* Reset to PEL mode */ (void)inb(pATI->CPIO_DAC_MASK); (void)inb(pATI->CPIO_DAC_MASK); (void)inb(pATI->CPIO_DAC_MASK); return inb(pATI->CPIO_DAC_MASK); + +#endif /* AVOID_CPIO */ + } /* @@ -159,6 +179,8 @@ ATIDACPreInit pATIHW->lut[Index2 + 2] = maxColour; } +#ifndef AVOID_CPIO + if (pATI->depth == 1) { rgb blackColour = pScreenInfo->display->whiteColour, @@ -186,6 +208,9 @@ ATIDACPreInit pATIHW->lut[Index + 1] = pATIHW->lut[Index + 2] = 0x00U; } + +#endif /* AVOID_CPIO */ + } } @@ -204,6 +229,33 @@ ATIDACSave { int Index; +#ifdef AVOID_CPIO + + pATIHW->dac_read = in8(M64_DAC_READ); + DACDelay; + pATIHW->dac_write = in8(M64_DAC_WRITE); + DACDelay; + pATIHW->dac_mask = in8(M64_DAC_MASK); + DACDelay; + + /* Save DAC's colour lookup table */ + out8(M64_DAC_MASK, 0xFFU); + DACDelay; + out8(M64_DAC_READ, 0x00U); + DACDelay; + for (Index = 0; Index < NumberOf(pATIHW->lut); Index++) + { + pATIHW->lut[Index] = in8(M64_DAC_DATA); + DACDelay; + } + + out8(M64_DAC_MASK, pATIHW->dac_mask); + DACDelay; + out8(M64_DAC_READ, pATIHW->dac_read); + DACDelay; + +#else /* AVOID_CPIO */ + ATISetDACIOPorts(pATI, pATIHW->crtc); pATIHW->dac_read = inb(pATI->CPIO_DAC_READ); @@ -228,6 +280,9 @@ ATIDACSave DACDelay; outb(pATI->CPIO_DAC_READ, pATIHW->dac_read); DACDelay; + +#endif /* AVOID_CPIO */ + } /* @@ -244,6 +299,28 @@ ATIDACSet { int Index; +#ifdef AVOID_CPIO + + /* Load DAC's colour lookup table */ + out8(M64_DAC_MASK, 0xFFU); + DACDelay; + out8(M64_DAC_WRITE, 0x00U); + DACDelay; + for (Index = 0; Index < NumberOf(pATIHW->lut); Index++) + { + out8(M64_DAC_DATA, pATIHW->lut[Index]); + DACDelay; + } + + out8(M64_DAC_MASK, pATIHW->dac_mask); + DACDelay; + out8(M64_DAC_READ, pATIHW->dac_read); + DACDelay; + out8(M64_DAC_WRITE, pATIHW->dac_write); + DACDelay; + +#else /* AVOID_CPIO */ + ATISetDACIOPorts(pATI, pATIHW->crtc); /* Load DAC's colour lookup table */ @@ -263,6 +340,9 @@ ATIDACSet DACDelay; outb(pATI->CPIO_DAC_WRITE, pATIHW->dac_write); DACDelay; + +#endif /* AVOID_CPIO */ + } /* @@ -334,6 +414,20 @@ ATILoadPalette Index < (SizeOf(pATI->NewHW.lut) / 3); Index += i, LUTEntry += i * 3) { + +#ifdef AVOID_CPIO + + out8(M64_DAC_WRITE, Index); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[0]); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[1]); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[2]); + DACDelay; + +#else /* AVOID_CPIO */ + outb(pATI->CPIO_DAC_WRITE, Index); DACDelay; outb(pATI->CPIO_DAC_DATA, LUTEntry[0]); @@ -342,6 +436,9 @@ ATILoadPalette DACDelay; outb(pATI->CPIO_DAC_DATA, LUTEntry[2]); DACDelay; + +#endif /* AVOID_CPIO */ + } } } @@ -360,6 +457,20 @@ ATILoadPalette if (pScreenInfo->vtSema || pATI->currentMode) { + +#ifdef AVOID_CPIO + + out8(M64_DAC_WRITE, Index); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[0]); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[1]); + DACDelay; + out8(M64_DAC_DATA, LUTEntry[2]); + DACDelay; + +#else /* AVOID_CPIO */ + outb(pATI->CPIO_DAC_WRITE, Index); DACDelay; outb(pATI->CPIO_DAC_DATA, LUTEntry[0]); @@ -368,6 +479,9 @@ ATILoadPalette DACDelay; outb(pATI->CPIO_DAC_DATA, LUTEntry[2]); DACDelay; + +#endif /* AVOID_CPIO */ + } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h index 868dbd502..56556d013 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.6 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.8 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -22,10 +22,18 @@ */ #ifndef ___ATIDAC_H___ + +#if !defined(___ATI_H___) && defined(XFree86Module) +# error missing #include "ati.h" before #include "atidac.h" +# undef XFree86Module +#endif + #define ___ATIDAC_H___ 1 +#include "ati.h" #include "aticrtc.h" #include "atiio.h" + #include "colormapst.h" /* @@ -68,21 +76,30 @@ typedef struct } DACRec; extern const DACRec ATIDACDescriptors[]; -#define DACDelay \ - do \ - { \ - (void)inb(GENS1(pATI->CPIO_VGABase)); \ - (void)inb(GENS1(pATI->CPIO_VGABase)); \ - } while (0) +#ifdef AVOID_CPIO + +# define DACDelay /* Nothing */ + +#else /* AVOID_CPIO */ + +# define DACDelay \ + do \ + { \ + (void)inb(GENS1(pATI->CPIO_VGABase)); \ + (void)inb(GENS1(pATI->CPIO_VGABase)); \ + } while (0) + + extern void ATISetDACIOPorts FunctionPrototype((ATIPtr, ATICRTCType)); + +#endif /* AVOID_CPIO */ -extern void ATISetDACIOPorts FunctionPrototype((ATIPtr, ATICRTCType)); -extern CARD8 ATIGetDACCmdReg FunctionPrototype((ATIPtr)); +extern CARD8 ATIGetDACCmdReg FunctionPrototype((ATIPtr)); -extern void ATIDACPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); -extern void ATIDACSave FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATIDACSet FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIDACPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); +extern void ATIDACSave FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIDACSet FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATILoadPalette FunctionPrototype((ScrnInfoPtr, int, int *, LOCO *, - VisualPtr)); +extern void ATILoadPalette FunctionPrototype((ScrnInfoPtr, int, int *, LOCO *, + VisualPtr)); #endif /* ___ATIDAC_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c index 9e8f91c48..a2c5acd04 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.1 2000/06/19 15:02:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.3 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -24,8 +24,11 @@ #include "ati.h" #include "atiadapter.h" #include "atiadjust.h" +#include "atichip.h" #include "atidac.h" #include "atidga.h" +#include "atiident.h" + #include "dgaproc.h" /* @@ -233,10 +236,14 @@ ATIDGAAddModes /* Fill in the mode structure */ pDGAMode->mode = pMode; + pDGAMode->flags = DGA_CONCURRENT_ACCESS; if (bitsPerPixel == pScreenInfo->bitsPerPixel) { pDGAMode->flags |= DGA_PIXMAP_AVAILABLE; pDGAMode->address = pATI->pMemory; + + if (pATI->OptionAccel) + pDGAMode->flags &= ~DGA_CONCURRENT_ACCESS; } if ((pMode->Flags & V_DBLSCAN) || (pMode->VScan > 1)) pDGAMode->flags |= DGA_DOUBLESCAN; @@ -299,6 +306,9 @@ ATIDGAInit { if (!pATI->nDGAMode) { + +#ifndef AVOID_CPIO + /* * Contrary to previous extension versions, DGA 2 does not support * banked framebuffers. Also, disable DGA when non-DGA server modes @@ -307,34 +317,40 @@ ATIDGAInit if (pATI->BankInfo.BankSize || (pScreenInfo->depth <= 4)) return FALSE; +#endif /* AVOID_CPIO */ + ATIDGAAddModes(pScreenInfo, pATI, 8, 8, 0, 0, 0, PseudoColor); - ATIDGAAddModes(pScreenInfo, pATI, - 15, 16, 0x7C00U, 0x03E0U, 0x001FU, TrueColor); + if ((pATI->Chip >= ATI_CHIP_264CT) && + (pATI->Chipset == ATI_CHIPSET_ATI)) + { + ATIDGAAddModes(pScreenInfo, pATI, 15, 16, + 0x7C00U, 0x03E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, - 16, 16, 0xF800U, 0x07E0U, 0x001FU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, 16, 16, + 0xF800U, 0x07E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, - 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, 24, 24, + 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, - 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, 24, 32, + 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); - if (pATI->DAC != ATI_DAC_INTERNAL) /* Not first revision */ - { - ATIDGAAddModes(pScreenInfo, pATI, - 15, 16, 0x7C00U, 0x03E0U, 0x001FU, DirectColor); + if (pATI->DAC != ATI_DAC_INTERNAL) /* Not first revision */ + { + ATIDGAAddModes(pScreenInfo, pATI, 15, 16, + 0x7C00U, 0x03E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, - 16, 16, 0xF800U, 0x07E0U, 0x001FU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, 16, 16, + 0xF800U, 0x07E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, - 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, 24, 24, + 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, - 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, 24, 32, + 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h index b84b1aaba..7340def10 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.1 2000/06/19 15:02:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.2 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" extern Bool ATIDGAInit FunctionPrototype((ScrnInfoPtr, ScreenPtr, ATIPtr)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c index ba121f99e..53c34388f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.10 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.12 2000/08/04 21:07:13 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,12 +21,12 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "ati.h" #include "atichip.h" #include "aticrtc.h" #include "atidsp.h" -#include "atiio.h" +#include "atimach64io.h" #include "atividmem.h" -#include "xf86.h" /* * ATIDSPPreInit -- @@ -37,17 +37,13 @@ Bool ATIDSPPreInit ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { CARD32 IOValue, dsp_config, dsp_on_off, vga_dsp_config, vga_dsp_on_off; int trp; - /* Set DSP register port numbers */ - pATI->CPIO_DSP_CONFIG = ATIIOPort(DSP_CONFIG); - pATI->CPIO_DSP_ON_OFF = ATIIOPort(DSP_ON_OFF); - /* * VT-B's and later have additional post-dividers that are not powers of * two. @@ -69,7 +65,7 @@ ATIDSPPreInit break; default: - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + xf86DrvMsg(iScreen, X_ERROR, "Unsupported XCLK source: %d.\n", pATI->XCLKPostDivider); return FALSE; } @@ -78,11 +74,11 @@ ATIDSPPreInit pATI->XCLKFeedbackDivider = ATIGetMach64PLLReg(PLL_MCLK_FB_DIV); /* Compute maximum RAS delay and friends */ - IOValue = inl(pATI->CPIO_MEM_INFO); - trp = GetBits(IOValue, CTL_MEM_TRP); - pATI->XCLKPageFaultDelay = GetBits(IOValue, CTL_MEM_TRCD) + - GetBits(IOValue, CTL_MEM_TCRD) + trp + 2; - pATI->XCLKMaxRASDelay = GetBits(IOValue, CTL_MEM_TRAS) + trp + 2; + trp = GetBits(pATI->LockData.mem_cntl, CTL_MEM_TRP); + pATI->XCLKPageFaultDelay = GetBits(pATI->LockData.mem_cntl, CTL_MEM_TRCD) + + GetBits(pATI->LockData.mem_cntl, CTL_MEM_TCRD) + trp + 2; + pATI->XCLKMaxRASDelay = GetBits(pATI->LockData.mem_cntl, CTL_MEM_TRAS) + + trp + 2; pATI->DisplayFIFODepth = 32; if (pATI->Chip < ATI_CHIP_264VT4) @@ -140,15 +136,15 @@ ATIDSPPreInit pATI->XCLKMaxRASDelay = pATI->XCLKPageFaultDelay + 1; /* Allow BIOS to override */ - dsp_config = inl(pATI->CPIO_DSP_CONFIG); - dsp_on_off = inl(pATI->CPIO_DSP_ON_OFF); - vga_dsp_config = inl(ATIIOPort(VGA_DSP_CONFIG)); - vga_dsp_on_off = inl(ATIIOPort(VGA_DSP_ON_OFF)); + dsp_config = inr(DSP_CONFIG); + dsp_on_off = inr(DSP_ON_OFF); + vga_dsp_config = inr(VGA_DSP_CONFIG); + vga_dsp_on_off = inr(VGA_DSP_ON_OFF); if (dsp_config) pATI->DisplayLoopLatency = GetBits(dsp_config, DSP_LOOP_LATENCY); - if (!dsp_on_off || + if ((!dsp_on_off && (pATI->Chip < ATI_CHIP_264GTPRO)) || ((dsp_on_off == vga_dsp_on_off) && (!dsp_config || !((dsp_config ^ vga_dsp_config) & DSP_XCLKS_PER_QW)))) { @@ -175,8 +171,8 @@ ATIDSPSave ATIHWPtr pATIHW ) { - pATIHW->dsp_on_off = inl(pATI->CPIO_DSP_ON_OFF); - pATIHW->dsp_config = inl(pATI->CPIO_DSP_CONFIG); + pATIHW->dsp_on_off = inr(DSP_ON_OFF); + pATIHW->dsp_config = inr(DSP_CONFIG); } @@ -209,12 +205,26 @@ ATIDSPCalculate Multiplier = pATI->XCLKFeedbackDivider * pATI->ClockDescriptor.PostDividers[pATIHW->PostDivider]; Divider = pATIHW->FeedbackDivider * pATI->XCLKReferenceDivider; + +#ifndef AVOID_CPIO + if (pATI->depth >= 8) + +#endif /* AVOID_CPIO */ + + { Divider *= pATI->bitsPerPixel / 4; - /* Start by assuming a display FIFO width of 32 bits */ - vshift = (5 - 2) - pATI->XCLKPostDivider; - if (pATIHW->crtc != ATI_CRTC_VGA) - vshift++; /* Nope, it's 64 bits wide */ + } + + /* Start by assuming a display FIFO width of 64 bits */ + vshift = (6 - 2) - pATI->XCLKPostDivider; + +#ifndef AVOID_CPIO + + if (pATIHW->crtc == ATI_CRTC_VGA) + vshift--; /* Nope, it's 32 bits wide */ + +#endif /* AVOID_CPIO */ if (!pATI->OptionCRT && (pATI->LCDPanelID >= 0)) { @@ -243,6 +253,9 @@ ATIDSPCalculate vshift, -1) - ATIDivide(1, 1, vshift - xshift, 1); /* Next is dsp_on */ + +#ifndef AVOID_CPIO + if ((pATIHW->crtc == ATI_CRTC_VGA) /* && (dsp_precision < 3) */) { /* @@ -252,6 +265,9 @@ ATIDSPCalculate dsp_on = ATIDivide(Multiplier * 5, Divider, vshift + 2, 1); } else + +#endif /* AVOID_CPIO */ + { dsp_on = ATIDivide(Multiplier, Divider, vshift, 1); tmp = ATIDivide(RASMultiplier, RASDivider, xshift, 1); @@ -261,8 +277,15 @@ ATIDSPCalculate ATIDivide(pATI->XCLKPageFaultDelay, 1, xshift, 1); } - if (dsp_on >= dsp_off) + /* Calculate rounding factor and apply it to dsp_on */ + tmp = ((1 << (Maximum_DSP_PRECISION - dsp_precision)) - 1) >> 1; + dsp_on = ((dsp_on + tmp) / (tmp + 1)) * (tmp + 1); + + if (dsp_on >= ((dsp_off / (tmp + 1)) * (tmp + 1))) + { dsp_on = dsp_off - ATIDivide(Multiplier, Divider, vshift, -1); + dsp_on = (dsp_on / (tmp + 1)) * (tmp + 1); + } /* Last but not least: dsp_xclks */ dsp_xclks = ATIDivide(Multiplier, Divider, vshift + 5, 1); @@ -287,6 +310,6 @@ ATIDSPSet ATIHWPtr pATIHW ) { - outl(pATI->CPIO_DSP_ON_OFF, pATIHW->dsp_on_off); - outl(pATI->CPIO_DSP_CONFIG, pATIHW->dsp_config); + outr(DSP_ON_OFF, pATIHW->dsp_on_off); + outr(DSP_CONFIG, pATIHW->dsp_config); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h index 4cbbb6ad0..c940de14d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.6 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,9 +26,10 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" -extern Bool ATIDSPPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr)); +extern Bool ATIDSPPreInit FunctionPrototype((int, ATIPtr)); extern void ATIDSPSave FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIDSPCalculate FunctionPrototype((ATIPtr, ATIHWPtr, DisplayModePtr)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c index 03fc99102..d0f334fce 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.5 2000/02/18 12:19:22 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.6 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -28,18 +28,29 @@ const char *ATIChipsetNames[] = { "ati", + +#ifndef AVOID_CPIO + "ativga", "ibmvga", "ibm8514", "vgawonder", "mach8", "mach32", - "mach64" + +#endif /* AVOID_CPIO */ + + "mach64", + "rage128", + "radeon" }; static SymTabRec ATIPublicChipsetNames[] = { {ATI_CHIPSET_ATI, "ati"}, + +#ifndef AVOID_CPIO + {ATI_CHIPSET_ATIVGA, "ativga"}, #ifdef __MAYBE_NOT__ {ATI_CHIPSET_IBMVGA, "ibmvga"}, @@ -47,6 +58,9 @@ static SymTabRec ATIPublicChipsetNames[] = #ifdef __NOT_YET__ {ATI_CHIPSET_IBM8514, "ibm8514"}, #endif + +#endif /* AVOID_CPIO */ + {-1, NULL} }; @@ -82,13 +96,20 @@ ATIIdentProbe static SymTabRec SpecificNames[] = { + +#ifndef AVOID_CPIO + {ATI_CHIPSET_VGAWONDER, "vgawonder"}, #ifdef __NOT_YET__ {ATI_CHIPSET_MACH8, "mach8"}, #endif {ATI_CHIPSET_MACH32, "mach32"}, + +#endif /* AVOID_CPIO */ + {ATI_CHIPSET_MACH64, "mach64"}, {ATI_CHIPSET_RAGE128, "rage128"}, + {ATI_CHIPSET_RADEON, "radeon"}, {-1, NULL} }; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h index a8f1075dc..c46c9ed08 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.6 2000/02/18 12:19:23 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -29,14 +29,21 @@ typedef enum { ATI_CHIPSET_ATI, + +#ifndef AVOID_CPIO + ATI_CHIPSET_ATIVGA, ATI_CHIPSET_IBMVGA, ATI_CHIPSET_IBM8514, ATI_CHIPSET_VGAWONDER, ATI_CHIPSET_MACH8, ATI_CHIPSET_MACH32, + +#endif /* AVOID_CPIO */ + ATI_CHIPSET_MACH64, ATI_CHIPSET_RAGE128, + ATI_CHIPSET_RADEON, ATI_CHIPSET_MAX /* Must be last */ } ATIChipsetType; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c index a4dd66ba5..d87670b4f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c,v 1.4 2000/02/18 12:19:23 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c,v 1.6 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,9 +21,12 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "ati.h" #include "atichip.h" #include "atiio.h" +#ifndef AVOID_CPIO + /* * ATISetVGAIOBase -- * @@ -96,24 +99,4 @@ ATIModifyExtReg ATIPutExtReg(Index, NewValue); } -/* - * ATIAccessMach64PLLReg -- - * - * This function sets up the addressing required to access, for read or write, - * a 264xT's PLL registers. - */ -void -ATIAccessMach64PLLReg -( - ATIPtr pATI, - const CARD8 Index, - const Bool Write -) -{ - CARD8 clock_cntl1 = inb(pATI->CPIO_CLOCK_CNTL + 1) & - ~GetByte(PLL_WR_EN | PLL_ADDR, 1); - - /* Set PLL register to be read or written */ - outb(pATI->CPIO_CLOCK_CNTL + 1, clock_cntl1 | - GetByte(SetBits(Index, PLL_ADDR) | SetBits(Write, PLL_WR_EN), 1)); -} +#endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h index 4c09b8dec..1c66c010f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.7 2000/03/30 15:41:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.8 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -22,13 +22,19 @@ */ #ifndef ___ATIIO_H___ -#define ___ATIIO_H___ 1 -#ifndef NO_COMPILER_H_EXTRAS -#define NO_COMPILER_H_EXTRAS +#if !defined(___ATI_H___) && defined(XFree86Module) +# error missing #include "ati.h" before #include "atiio.h" +# undef XFree86Module #endif +#define ___ATIIO_H___ 1 + #include "atistruct.h" + +#ifndef NO_COMPILER_H_EXTRAS +# define NO_COMPILER_H_EXTRAS +#endif #include "compiler.h" /* I/O decoding definitions */ @@ -38,16 +44,14 @@ typedef enum BLOCK_IO } ATIIODecodingType; -#define ATIIOPort(_PortTag) \ - (((pATI->CPIODecoding == SPARSE_IO) ? \ - (((_PortTag) & SPARSE_IO_SELECT) | ((_PortTag) & IO_BYTE_SELECT)) : \ - (((_PortTag) & BLOCK_IO_SELECT) | ((_PortTag) & IO_BYTE_SELECT))) | \ - pATI->CPIOBase) +#ifndef AVOID_CPIO extern void ATISetVGAIOBase FunctionPrototype((ATIPtr, const CARD8)); extern void ATIModifyExtReg FunctionPrototype((ATIPtr, const CARD8, int, const CARD8, CARD8)); +#endif /* AVOID_CPIO */ + /* Odds and ends to ease reading and writting of registers */ #define GetReg(_Register, _Index) \ ( \ @@ -65,42 +69,6 @@ extern void ATIModifyExtReg FunctionPrototype((ATIPtr, const CARD8, int, #define ATIPutExtReg(_Index, _Value) \ PutReg(pATI->CPIO_VGAWonder, _Index, _Value) -extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, - const Bool)); - -#define ATIGetMach64PLLReg(_Index) \ - ( \ - ATIAccessMach64PLLReg(pATI, _Index, FALSE), \ - inb(pATI->CPIO_CLOCK_CNTL + 2) \ - ) -#define ATIPutMach64PLLReg(_Index, _Value) \ - ( \ - ATIAccessMach64PLLReg(pATI, _Index, TRUE), \ - outb(pATI->CPIO_CLOCK_CNTL + 2, _Value) \ - ) - -#define ATIGetLTProLCDReg(_Index) \ - ( \ - outb(pATI->CPIO_LCD_INDEX, SetBits((_Index), LCD_REG_INDEX)), \ - inl(pATI->CPIO_LCD_DATA) \ - ) -#define ATIPutLTProLCDReg(_Index, _Value) \ - ( \ - outb(pATI->CPIO_LCD_INDEX, SetBits((_Index), LCD_REG_INDEX)), \ - outl(pATI->CPIO_LCD_DATA, (_Value)) \ - ) - -#define ATIGetLTProTVReg(_Index) \ - ( \ - outb(pATI->CPIO_TV_OUT_INDEX, SetBits((_Index), TV_REG_INDEX)), \ - inl(pATI->CPIO_TV_OUT_DATA) \ - ) -#define ATIPutLTProTVReg(_Index, _Value) \ - ( \ - outb(pATI->CPIO_TV_OUT_INDEX, SetBits((_Index), TV_REG_INDEX)), \ - outl(pATI->CPIO_TV_OUT_DATA, (_Value)) \ - ) - /* Wait until "n" queue entries are free */ #define ibm8514WaitQueue(_n) \ { \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c index 75c0e0485..c0083abb3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.6 2000/03/22 03:08:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -24,8 +24,8 @@ #include "ati.h" #include "atiadapter.h" #include "atichip.h" -#include "atiio.h" #include "atilock.h" +#include "atimach64io.h" /* * ATIUnlock -- @@ -39,12 +39,20 @@ ATIUnlock ATIPtr pATI ) { - CARD32 tmp, saved_lcd_gen_ctrl = 0, lcd_gen_ctrl = 0; + CARD32 tmp; + +#ifndef AVOID_CPIO + + CARD32 saved_lcd_gen_ctrl = 0, lcd_gen_ctrl = 0; + +#endif /* AVOID_CPIO */ if (pATI->Unlocked) return; pATI->Unlocked = TRUE; +#ifndef AVOID_CPIO + if (pATI->ChipHasSUBSYS_CNTL) { /* Save register values to be modified */ @@ -83,15 +91,13 @@ ATIUnlock ProbeWaitIdleEmpty(); } else if (pATI->Chip >= ATI_CHIP_88800GXC) - { - /* Save register values to be modified */ - pATI->LockData.config_cntl = inl(pATI->CPIO_CONFIG_CNTL); - pATI->LockData.dac_cntl = inl(pATI->CPIO_DAC_CNTL); +#endif /* AVOID_CPIO */ + + { /* Reset everything */ pATI->LockData.bus_cntl = - (inl(pATI->CPIO_BUS_CNTL) & ~BUS_HOST_ERR_INT_EN) | - BUS_HOST_ERR_INT; + (inr(BUS_CNTL) & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT; if (pATI->Chip < ATI_CHIP_264VTB) pATI->LockData.bus_cntl = (pATI->LockData.bus_cntl & ~BUS_FIFO_ERR_INT_EN) | @@ -100,44 +106,55 @@ ATIUnlock SetBits(15, BUS_FIFO_WS); if (pATI->Chip >= ATI_CHIP_264VT) tmp |= BUS_EXT_REG_EN; /* Enable Block 1 */ - outl(pATI->CPIO_BUS_CNTL, tmp); - pATI->LockData.crtc_int_cntl = inl(pATI->CPIO_CRTC_INT_CNTL); - outl(pATI->CPIO_CRTC_INT_CNTL, - (pATI->LockData.crtc_int_cntl & ~CRTC_INT_ENS) | CRTC_INT_ACKS); - pATI->LockData.gen_test_cntl = inl(pATI->CPIO_GEN_TEST_CNTL) & + outr(BUS_CNTL, tmp); + pATI->LockData.crtc_int_cntl = inr(CRTC_INT_CNTL); + outr(CRTC_INT_CNTL, (pATI->LockData.crtc_int_cntl & ~CRTC_INT_ENS) | + CRTC_INT_ACKS); + pATI->LockData.gen_test_cntl = inr(GEN_TEST_CNTL) & (GEN_OVR_OUTPUT_EN | GEN_OVR_POLARITY | GEN_CUR_EN | GEN_BLOCK_WR_EN); tmp = pATI->LockData.gen_test_cntl & ~GEN_CUR_EN; - outl(pATI->CPIO_GEN_TEST_CNTL, tmp | GEN_GUI_EN); - outl(pATI->CPIO_GEN_TEST_CNTL, tmp); - outl(pATI->CPIO_GEN_TEST_CNTL, tmp | GEN_GUI_EN); - tmp = pATI->LockData.crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL) & + outr(GEN_TEST_CNTL, tmp | GEN_GUI_EN); + outr(GEN_TEST_CNTL, tmp); + outr(GEN_TEST_CNTL, tmp | GEN_GUI_EN); + tmp = pATI->LockData.crtc_gen_cntl = inr(CRTC_GEN_CNTL) & ~(CRTC_EN | CRTC_LOCK_REGS); if (pATI->Chip >= ATI_CHIP_264XL) tmp = (tmp & ~CRTC_INT_ENS_X) | CRTC_INT_ACKS_X; - outl(pATI->CPIO_CRTC_GEN_CNTL, tmp | CRTC_EN); - outl(pATI->CPIO_CRTC_GEN_CNTL, tmp); - outl(pATI->CPIO_CRTC_GEN_CNTL, tmp | CRTC_EN); + outr(CRTC_GEN_CNTL, tmp | CRTC_EN); + outr(CRTC_GEN_CNTL, tmp); + outr(CRTC_GEN_CNTL, tmp | CRTC_EN); if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT)) { - pATI->LockData.lcd_index = inl(pATI->CPIO_LCD_INDEX); + pATI->LockData.lcd_index = inr(LCD_INDEX); if (pATI->Chip >= ATI_CHIP_264XL) - outl(pATI->CPIO_LCD_INDEX, pATI->LockData.lcd_index & + outr(LCD_INDEX, pATI->LockData.lcd_index & ~(LCD_MONDET_INT_EN | LCD_MONDET_INT)); } +#ifndef AVOID_CPIO + /* Ensure VGA aperture is enabled */ - outl(pATI->CPIO_DAC_CNTL, pATI->LockData.dac_cntl | DAC_VGA_ADR_EN); - outl(pATI->CPIO_CONFIG_CNTL, - pATI->LockData.config_cntl & ~CFG_VGA_DIS); + pATI->LockData.config_cntl = inr(CONFIG_CNTL); + pATI->LockData.dac_cntl = inr(DAC_CNTL); + outr(DAC_CNTL, pATI->LockData.dac_cntl | DAC_VGA_ADR_EN); + outr(CONFIG_CNTL, pATI->LockData.config_cntl & ~CFG_VGA_DIS); + +#endif /* AVOID_CPIO */ + + pATI->LockData.mem_cntl = inr(MEM_CNTL); if (pATI->Chip < ATI_CHIP_264CT) - { - pATI->LockData.mem_info = inl(pATI->CPIO_MEM_INFO); - outl(pATI->CPIO_MEM_INFO, pATI->LockData.mem_info & + outr(MEM_CNTL, pATI->LockData.mem_cntl & ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); - } + else if (pATI->Chip >= ATI_CHIP_264VTB) + outr(MEM_CNTL, (pATI->LockData.mem_cntl & + ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) | + (SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN) | + SetBits(CTL_MEM_APER_LONG_ENDIAN, CTL_MEM_UPPER_APER_ENDIAN))); } +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { if (pATI->CPIO_VGAWonder) @@ -178,23 +195,23 @@ ATIUnlock { if (pATI->Chip == ATI_CHIP_264LT) { - saved_lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + saved_lcd_gen_ctrl = inr(LCD_GEN_CTRL); /* Setup to unlock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - saved_lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); + saved_lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); /* Setup to unlock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); } } @@ -256,11 +273,11 @@ ATIUnlock lcd_gen_ctrl |= SHADOW_EN | SHADOW_RW_EN; if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); /* Unlock shadow registers */ ATISetVGAIOBase(pATI, inb(R_GENMO)); @@ -276,6 +293,11 @@ ATIUnlock GetReg(CRTX(pATI->CPIO_VGABase), 0x11U); if (tmp & 0x80U) /* Unprotect CRTC[0-7] */ outb(CRTD(pATI->CPIO_VGABase), tmp & 0x7FU); + else if (!tmp && pATI->LockData.crt11) + { + pATI->LockData.shadow_crt11 = tmp = pATI->LockData.crt11; + outb(CRTD(pATI->CPIO_VGABase), tmp & 0x7FU); + } } else { @@ -312,19 +334,21 @@ ATIUnlock /* Restore selection */ if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, saved_lcd_gen_ctrl); + outr(LCD_GEN_CTRL, saved_lcd_gen_ctrl); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - ATIPutLTProLCDReg(LCD_GEN_CNTL, saved_lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, saved_lcd_gen_ctrl); /* Restore LCD index */ - outb(pATI->CPIO_LCD_INDEX, - GetByte(pATI->LockData.lcd_index, 0)); + out8(LCD_INDEX, GetByte(pATI->LockData.lcd_index, 0)); } } } + +#endif /* AVOID_CPIO */ + } /* @@ -338,35 +362,42 @@ ATILock ATIPtr pATI ) { + +#ifndef AVOID_CPIO + CARD32 tmp, saved_lcd_gen_ctrl = 0, lcd_gen_ctrl = 0; +#endif /* AVOID_CPIO */ + if (!pATI->Unlocked) return; pATI->Unlocked = FALSE; +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { if (pATI->LCDPanelID >= 0) { if (pATI->Chip == ATI_CHIP_264LT) { - saved_lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + saved_lcd_gen_ctrl = inr(LCD_GEN_CTRL); /* Setup to lock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - saved_lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); + saved_lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); /* Setup to lock non-shadow registers */ lcd_gen_ctrl = saved_lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); } } @@ -382,11 +413,11 @@ ATILock lcd_gen_ctrl |= SHADOW_EN | SHADOW_RW_EN; if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); /* Lock shadow registers */ ATISetVGAIOBase(pATI, inb(R_GENMO)); @@ -398,11 +429,11 @@ ATILock /* Restore selection */ if (pATI->Chip == ATI_CHIP_264LT) - outl(pATI->CPIO_LCD_GEN_CTRL, saved_lcd_gen_ctrl); + outr(LCD_GEN_CTRL, saved_lcd_gen_ctrl); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutLTProLCDReg(LCD_GEN_CNTL, saved_lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, saved_lcd_gen_ctrl); } if (pATI->CPIO_VGAWonder) @@ -452,30 +483,32 @@ ATILock ProbeWaitIdleEmpty(); } else if (pATI->Chip >= ATI_CHIP_88800GXC) + +#endif /* AVOID_CPIO */ + { /* Reset everything */ - outl(pATI->CPIO_BUS_CNTL, pATI->LockData.bus_cntl); + outr(BUS_CNTL, pATI->LockData.bus_cntl); - outl(pATI->CPIO_CRTC_INT_CNTL, pATI->LockData.crtc_int_cntl); + outr(CRTC_INT_CNTL, pATI->LockData.crtc_int_cntl); - outl(pATI->CPIO_GEN_TEST_CNTL, - pATI->LockData.gen_test_cntl | GEN_GUI_EN); - outl(pATI->CPIO_GEN_TEST_CNTL, pATI->LockData.gen_test_cntl); - outl(pATI->CPIO_GEN_TEST_CNTL, - pATI->LockData.gen_test_cntl | GEN_GUI_EN); + outr(GEN_TEST_CNTL, pATI->LockData.gen_test_cntl | GEN_GUI_EN); + outr(GEN_TEST_CNTL, pATI->LockData.gen_test_cntl); + outr(GEN_TEST_CNTL, pATI->LockData.gen_test_cntl | GEN_GUI_EN); - outl(pATI->CPIO_CRTC_GEN_CNTL, - pATI->LockData.crtc_gen_cntl | CRTC_EN); - outl(pATI->CPIO_CRTC_GEN_CNTL, pATI->LockData.crtc_gen_cntl); - outl(pATI->CPIO_CRTC_GEN_CNTL, - pATI->LockData.crtc_gen_cntl | CRTC_EN); + outr(CRTC_GEN_CNTL, pATI->LockData.crtc_gen_cntl | CRTC_EN); + outr(CRTC_GEN_CNTL, pATI->LockData.crtc_gen_cntl); + outr(CRTC_GEN_CNTL, pATI->LockData.crtc_gen_cntl | CRTC_EN); - /* Restore registers */ - outl(pATI->CPIO_CONFIG_CNTL, pATI->LockData.config_cntl); - outl(pATI->CPIO_DAC_CNTL, pATI->LockData.dac_cntl); - if (pATI->Chip < ATI_CHIP_264CT) - outl(pATI->CPIO_MEM_INFO, pATI->LockData.mem_info); - else if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT)) - outl(pATI->CPIO_LCD_INDEX, pATI->LockData.lcd_index); +#ifndef AVOID_CPIO + + outr(CONFIG_CNTL, pATI->LockData.config_cntl); + outr(DAC_CNTL, pATI->LockData.dac_cntl); + +#endif /* AVOID_CPIO */ + + outr(MEM_CNTL, pATI->LockData.mem_cntl); + if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT)) + outr(LCD_INDEX, pATI->LockData.lcd_index); } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c index 2d53d1629..b0b3caf96 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.21 2000/06/19 15:00:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.23 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -47,116 +47,17 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" -#include "atiio.h" #include "atimach64.h" +#include "atimach64io.h" + #include "miline.h" -#define DPMS_SERVER +#ifndef DPMS_SERVER +# define DPMS_SERVER +#endif #include "extensions/dpms.h" /* - * Note: Only 32-bit MMIO is needed here. - */ - -#define inm(_Register) \ - MMIO_IN32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ - (_Register) & MM_IO_SELECT) - -/* - * ATIMach64PollEngineStatus -- - * - * This function refreshes the driver's view of the draw engine's status. - */ -static void -ATIMach64PollEngineStatus -( - ATIPtr pATI -) -{ - CARD32 IOValue; - int Count; - - if (pATI->Chip < ATI_CHIP_264VTB) - { - /* - * TODO: Deal with locked engines. - */ - IOValue = inm(FIFO_STAT); - pATI->EngineIsLocked = GetBits(IOValue, FIFO_ERR); - - /* - * The following counts the number of bits in FIFO_STAT_BITS, and is - * derived from miSetVisualTypes() (formerly cfbSetVisualTypes()). - */ - IOValue = GetBits(IOValue, FIFO_STAT_BITS); - Count = (IOValue >> 1) & 0x36DBU; - Count = IOValue - Count - ((Count >> 1) & 0x36DBU); - Count = ((Count + (Count >> 3)) & 0x71C7U) % 0x3FU; - Count = pATI->nFIFOEntries - Count; - if (Count > pATI->nAvailableFIFOEntries) - pATI->nAvailableFIFOEntries = Count; - - /* - * If the command FIFO is non-empty, then the engine isn't idle. - */ - if (pATI->nAvailableFIFOEntries < pATI->nFIFOEntries) - { - pATI->EngineIsBusy = TRUE; - return; - } - } - - IOValue = inm(GUI_STAT); - pATI->EngineIsBusy = GetBits(IOValue, GUI_ACTIVE); - Count = GetBits(IOValue, GUI_FIFO); - if (Count > pATI->nAvailableFIFOEntries) - pATI->nAvailableFIFOEntries = Count; -} - -/* - * MMIO cache definitions. - */ -#define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register) >> 3] -#define CacheBit(___Register) (0x80U >> (CacheSlotOf(___Register) & 0x07U)) - -#define RegisterIsCached(__Register) \ - (CacheByte(__Register) & CacheBit(__Register)) -#define CacheRegister(__Register) \ - CacheByte(__Register) |= CacheBit(__Register) -#define UncacheRegister(__Register) \ - CacheByte(__Register) &= ~CacheBit(__Register) - -#define CacheSlot(__Register) pATI->MMIOCache[CacheSlotOf(__Register)] - -/* This would be quite a bit slower as a function */ -#define outm(_Register, _Value) \ - do \ - { \ - CARD32 _IOValue = (_Value); \ - \ - if (!RegisterIsCached(_Register) || \ - (_IOValue != CacheSlot(_Register))) \ - { \ - while (!pATI->nAvailableFIFOEntries--) \ - ATIMach64PollEngineStatus(pATI); \ - MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ - (_Register) & MM_IO_SELECT, _IOValue); \ - CacheSlot(_Register) = _IOValue; \ - pATI->EngineIsBusy = TRUE; \ - } \ - } while (0) - -/* This is no longer as critical, especially for _n == 1 */ -#define ATIMach64WaitForFIFO(_n) \ - while ((pATI->nAvailableFIFOEntries < (_n)) && \ - (pATI->nAvailableFIFOEntries < pATI->nFIFOEntries)) \ - ATIMach64PollEngineStatus(pATI) - -#define ATIMach64WaitForIdle() \ - while (pATI->EngineIsBusy) \ - ATIMach64PollEngineStatus(pATI) - -/* * X-to-Mach64 mix translation table. */ static CARD8 ATIMach64ALU[16] = @@ -196,12 +97,19 @@ ATIMach64PreInit CARD32 bus_cntl, config_cntl; int tmp; +#ifndef AVOID_CPIO + if (pATI->depth <= 4) pATIHW->crtc_off_pitch = SetBits(pATI->displayWidth >> 4, CRTC_PITCH); else + +#endif /* AVOID_CPIO */ + + { pATIHW->crtc_off_pitch = SetBits(pATI->displayWidth >> 3, CRTC_PITCH); + } - bus_cntl = inl(pATI->CPIO_BUS_CNTL); + bus_cntl = inr(BUS_CNTL); pATIHW->bus_cntl = (bus_cntl & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT; if (pATI->Chip < ATI_CHIP_264VTB) { @@ -213,26 +121,42 @@ ATIMach64PreInit if (pATI->Chip >= ATI_CHIP_264VT) pATIHW->bus_cntl |= BUS_EXT_REG_EN; /* Enable Block 1 */ - pATIHW->mem_vga_wp_sel = - /* SetBits(0, MEM_VGA_WPS0) | */ +#ifdef AVOID_CPIO + + pATIHW->mem_vga_wp_sel = SetBits(0, MEM_VGA_WPS0) | + SetBits(1, MEM_VGA_WPS1); + pATIHW->mem_vga_rp_sel = SetBits(0, MEM_VGA_RPS0) | + SetBits(1, MEM_VGA_RPS1); + +#else /* AVOID_CPIO */ + + pATIHW->mem_vga_wp_sel = SetBits(0, MEM_VGA_WPS0) | SetBits(pATIHW->nPlane, MEM_VGA_WPS1); - pATIHW->mem_vga_rp_sel = - /* SetBits(0, MEM_VGA_RPS0) | */ + pATIHW->mem_vga_rp_sel = SetBits(0, MEM_VGA_RPS0) | SetBits(pATIHW->nPlane, MEM_VGA_RPS1); - pATIHW->dac_cntl = inl(pATI->CPIO_DAC_CNTL) & +#endif /* AVOID_CPIO */ + + pATIHW->dac_cntl = inr(DAC_CNTL) & ~(DAC1_CLK_SEL | DAC_PALETTE_ACCESS_CNTL | DAC_8BIT_EN); if ((pATI->depth > 8) || (pScreenInfo->rgbBits == 8)) pATIHW->dac_cntl |= DAC_8BIT_EN; - pATIHW->config_cntl = config_cntl = inl(pATI->CPIO_CONFIG_CNTL); + pATIHW->config_cntl = config_cntl = inr(CONFIG_CNTL); + +#ifndef AVOID_CPIO + if (pATI->UseSmallApertures) pATIHW->config_cntl |= CFG_MEM_VGA_AP_EN; else + +#endif /* AVOID_CPIO */ + + { pATIHW->config_cntl &= ~CFG_MEM_VGA_AP_EN; - if (pATI->LinearBase && - ((pATI->Chip < ATI_CHIP_264CT) || - ((pATI->BusType != ATI_BUS_PCI) && (pATI->BusType != ATI_BUS_AGP)))) + } + + if (pATI->LinearBase && (pATI->Chip < ATI_CHIP_264CT)) { /* Replace linear aperture size and address */ pATIHW->config_cntl &= ~(CFG_MEM_AP_LOC | CFG_MEM_AP_SIZE); @@ -247,8 +171,8 @@ ATIMach64PreInit if (pATI->OptionAccel) { /* Ensure apertures are enabled */ - outl(pATI->CPIO_BUS_CNTL, pATIHW->bus_cntl); - outl(pATI->CPIO_CONFIG_CNTL, pATIHW->config_cntl); + outr(BUS_CNTL, pATIHW->bus_cntl); + outr(CONFIG_CNTL, pATIHW->config_cntl); /* * When possible, max out command FIFO size. @@ -283,7 +207,7 @@ ATIMach64PreInit { case 8: pATIHW->dp_chain_mask = DP_CHAIN_8BPP; - pATIHW->dp_pix_width = /* DP_BYTE_PIX_ORDER | */ + pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -291,7 +215,7 @@ ATIMach64PreInit case 15: pATIHW->dp_chain_mask = DP_CHAIN_15BPP_1555; - pATIHW->dp_pix_width = /* DP_BYTE_PIX_ORDER | */ + pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | SetBits(PIX_WIDTH_15BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_15BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -299,7 +223,7 @@ ATIMach64PreInit case 16: pATIHW->dp_chain_mask = DP_CHAIN_16BPP_565; - pATIHW->dp_pix_width = /* DP_BYTE_PIX_ORDER | */ + pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | SetBits(PIX_WIDTH_16BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_16BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -309,7 +233,7 @@ ATIMach64PreInit if (pATI->bitsPerPixel == 24) { pATIHW->dp_chain_mask = DP_CHAIN_24BPP_888; - pATIHW->dp_pix_width = /* DP_BYTE_PIX_ORDER | */ + pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -317,7 +241,7 @@ ATIMach64PreInit else { pATIHW->dp_chain_mask = DP_CHAIN_32BPP_8888; - pATIHW->dp_pix_width = /* DP_BYTE_PIX_ORDER | */ + pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | SetBits(PIX_WIDTH_32BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_32BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -337,8 +261,8 @@ ATIMach64PreInit pATIHW->clr_cmp_msk = (CARD32)(-1); /* Restore aperture enablement */ - outl(pATI->CPIO_BUS_CNTL, bus_cntl); - outl(pATI->CPIO_CONFIG_CNTL, config_cntl); + outr(BUS_CNTL, bus_cntl); + outr(CONFIG_CNTL, config_cntl); } } @@ -355,38 +279,38 @@ ATIMach64Save ATIHWPtr pATIHW ) { - pATIHW->crtc_h_total_disp = inl(pATI->CPIO_CRTC_H_TOTAL_DISP); - pATIHW->crtc_h_sync_strt_wid = inl(pATI->CPIO_CRTC_H_SYNC_STRT_WID); - pATIHW->crtc_v_total_disp = inl(pATI->CPIO_CRTC_V_TOTAL_DISP); - pATIHW->crtc_v_sync_strt_wid = inl(pATI->CPIO_CRTC_V_SYNC_STRT_WID); + pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP); + pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); + pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP); + pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); - pATIHW->crtc_off_pitch = inl(pATI->CPIO_CRTC_OFF_PITCH); + pATIHW->crtc_off_pitch = inr(CRTC_OFF_PITCH); - pATIHW->crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL); + pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL); - pATIHW->ovr_clr = inl(pATI->CPIO_OVR_CLR); - pATIHW->ovr_wid_left_right = inl(pATI->CPIO_OVR_WID_LEFT_RIGHT); - pATIHW->ovr_wid_top_bottom = inl(pATI->CPIO_OVR_WID_TOP_BOTTOM); + pATIHW->ovr_clr = inr(OVR_CLR); + pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); + pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); - pATIHW->clock_cntl = inl(pATI->CPIO_CLOCK_CNTL); + pATIHW->clock_cntl = inr(CLOCK_CNTL); - pATIHW->bus_cntl = inl(pATI->CPIO_BUS_CNTL); + pATIHW->bus_cntl = inr(BUS_CNTL); - pATIHW->mem_vga_wp_sel = inl(pATI->CPIO_MEM_VGA_WP_SEL); - pATIHW->mem_vga_rp_sel = inl(pATI->CPIO_MEM_VGA_RP_SEL); + pATIHW->mem_vga_wp_sel = inr(MEM_VGA_WP_SEL); + pATIHW->mem_vga_rp_sel = inr(MEM_VGA_RP_SEL); - pATIHW->dac_cntl = inl(pATI->CPIO_DAC_CNTL); + pATIHW->dac_cntl = inr(DAC_CNTL); - pATIHW->config_cntl = inl(pATI->CPIO_CONFIG_CNTL); + pATIHW->config_cntl = inr(CONFIG_CNTL); /* Save draw engine state */ if (pATI->OptionAccel && (pATIHW == &pATI->OldHW)) { /* Ensure apertures are enabled */ - outl(pATI->CPIO_BUS_CNTL, pATI->NewHW.bus_cntl); - outl(pATI->CPIO_CONFIG_CNTL, pATI->NewHW.config_cntl); + outr(BUS_CNTL, pATI->NewHW.bus_cntl); + outr(CONFIG_CNTL, pATI->NewHW.config_cntl); - ATIMach64WaitForIdle(); + ATIMach64WaitForIdle(pATI); /* Save FIFO size */ if (pATI->Chip >= ATI_CHIP_264VT4) @@ -423,10 +347,10 @@ ATIMach64Save pATIHW->pat_cntl = inm(PAT_CNTL); /* Save scissor registers */ - pATIHW->sc_left = inm(SC_LEFT); - pATIHW->sc_right = inm(SC_RIGHT); - pATIHW->sc_top = inm(SC_TOP); - pATIHW->sc_bottom = inm(SC_BOTTOM); + pATIHW->sc_left = pATI->sc_left = inm(SC_LEFT); + pATIHW->sc_right = pATI->sc_right = inm(SC_RIGHT); + pATIHW->sc_top = pATI->sc_top = inm(SC_TOP); + pATIHW->sc_bottom = pATI->sc_bottom = inm(SC_BOTTOM); /* Save data path registers */ pATIHW->dp_bkgd_clr = inm(DP_BKGD_CLR); @@ -446,8 +370,8 @@ ATIMach64Save pATIHW->context_mask = inm(CONTEXT_MASK); /* Restore aperture enablement */ - outl(pATI->CPIO_BUS_CNTL, pATIHW->bus_cntl); - outl(pATI->CPIO_CONFIG_CNTL, pATIHW->config_cntl); + outr(BUS_CNTL, pATIHW->bus_cntl); + outr(CONFIG_CNTL, pATIHW->config_cntl); } } @@ -565,7 +489,7 @@ ATIMach64Calculate if (pMode->Flags & V_NVSYNC) pATIHW->crtc_v_sync_strt_wid |= CRTC_V_SYNC_POL; - pATIHW->crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL) & + pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL) & ~(CRTC_DBL_SCAN_EN | CRTC_INTERLACE_EN | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | CRTC_CSYNC_EN | CRTC_PIX_BY_2_EN | CRTC_DISPLAY_DIS | CRTC_VGA_XOVERSCAN | @@ -578,21 +502,31 @@ ATIMach64Calculate CRTC_EXT_DISP_EN | CRTC_EN | CRTC_VGA_LINEAR | CRTC_CNT_EN; switch (pATI->depth) { + +#ifndef AVOID_CPIO + case 1: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_1BPP, CRTC_PIX_WIDTH); break; + case 4: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_4BPP, CRTC_PIX_WIDTH); break; + +#endif /* AVOID_CPIO */ + case 8: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_8BPP, CRTC_PIX_WIDTH); break; + case 15: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_15BPP, CRTC_PIX_WIDTH); break; + case 16: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_16BPP, CRTC_PIX_WIDTH); break; + case 24: if (pATI->bitsPerPixel == 24) { @@ -603,9 +537,11 @@ ATIMach64Calculate if (pATI->bitsPerPixel != 32) break; /* Fall through */ + case 32: pATIHW->crtc_gen_cntl |= SetBits(PIX_WIDTH_32BPP, CRTC_PIX_WIDTH); break; + default: break; } @@ -633,30 +569,30 @@ ATIMach64Set ) { /* First, turn off the display */ - outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & ~CRTC_EN); + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & ~CRTC_EN); if ((pATIHW->FeedbackDivider > 0) && (pATI->ProgrammableClock != ATI_CLOCK_NONE)) ATIClockSet(pATI, pATIHW); /* Programme clock */ /* Load Mach64 CRTC registers */ - outl(pATI->CPIO_CRTC_H_TOTAL_DISP, pATIHW->crtc_h_total_disp); - outl(pATI->CPIO_CRTC_H_SYNC_STRT_WID, pATIHW->crtc_h_sync_strt_wid); - outl(pATI->CPIO_CRTC_V_TOTAL_DISP, pATIHW->crtc_v_total_disp); - outl(pATI->CPIO_CRTC_V_SYNC_STRT_WID, pATIHW->crtc_v_sync_strt_wid); + outr(CRTC_H_TOTAL_DISP, pATIHW->crtc_h_total_disp); + outr(CRTC_H_SYNC_STRT_WID, pATIHW->crtc_h_sync_strt_wid); + outr(CRTC_V_TOTAL_DISP, pATIHW->crtc_v_total_disp); + outr(CRTC_V_SYNC_STRT_WID, pATIHW->crtc_v_sync_strt_wid); - outl(pATI->CPIO_CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); + outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); /* Set pixel clock */ - outl(pATI->CPIO_CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); + outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); /* Load overscan registers */ - outl(pATI->CPIO_OVR_CLR, pATIHW->ovr_clr); - outl(pATI->CPIO_OVR_WID_LEFT_RIGHT, pATIHW->ovr_wid_left_right); - outl(pATI->CPIO_OVR_WID_TOP_BOTTOM, pATIHW->ovr_wid_top_bottom); + outr(OVR_CLR, pATIHW->ovr_clr); + outr(OVR_WID_LEFT_RIGHT, pATIHW->ovr_wid_left_right); + outr(OVR_WID_TOP_BOTTOM, pATIHW->ovr_wid_top_bottom); /* Finalise CRTC setup and turn on the screen */ - outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); /* Load draw engine */ if (pATI->OptionAccel) @@ -665,11 +601,11 @@ ATIMach64Set (void)memset(pATI->MMIOCached, 0, SizeOf(pATI->MMIOCached)); /* Ensure apertures are enabled */ - outl(pATI->CPIO_BUS_CNTL, pATI->NewHW.bus_cntl); - outl(pATI->CPIO_CONFIG_CNTL, pATI->NewHW.config_cntl); + outr(BUS_CNTL, pATI->NewHW.bus_cntl); + outr(CONFIG_CNTL, pATI->NewHW.config_cntl); pATI->EngineIsBusy = TRUE; /* Force engine poll */ - ATIMach64WaitForIdle(); + ATIMach64WaitForIdle(pATI); /* Load FIFO size */ if (pATI->Chip >= ATI_CHIP_264VT4) @@ -683,65 +619,77 @@ ATIMach64Set pATI->nFIFOEntries = pATI->nAvailableFIFOEntries; /* Load destination registers */ - ATIMach64WaitForFIFO(7); - outm(DST_OFF_PITCH, pATIHW->dst_off_pitch); - outm(DST_Y_X, SetWord(pATIHW->dst_x, 1) | SetWord(pATIHW->dst_y, 0)); - outm(DST_HEIGHT, pATIHW->dst_height); - outm(DST_BRES_ERR, pATIHW->dst_bres_err); - outm(DST_BRES_INC, pATIHW->dst_bres_inc); - outm(DST_BRES_DEC, pATIHW->dst_bres_dec); - outm(DST_CNTL, pATIHW->dst_cntl); + ATIMach64WaitForFIFO(pATI, 7); + outf(DST_OFF_PITCH, pATIHW->dst_off_pitch); + outf(DST_Y_X, SetWord(pATIHW->dst_x, 1) | SetWord(pATIHW->dst_y, 0)); + outf(DST_HEIGHT, pATIHW->dst_height); + outf(DST_BRES_ERR, pATIHW->dst_bres_err); + outf(DST_BRES_INC, pATIHW->dst_bres_inc); + outf(DST_BRES_DEC, pATIHW->dst_bres_dec); + outf(DST_CNTL, pATIHW->dst_cntl); /* Load source registers */ - ATIMach64WaitForFIFO(6); - outm(SRC_OFF_PITCH, pATIHW->src_off_pitch); - outm(SRC_Y_X, SetWord(pATIHW->src_x, 1) | SetWord(pATIHW->src_y, 0)); - outm(SRC_HEIGHT1_WIDTH1, + ATIMach64WaitForFIFO(pATI, 6); + outf(SRC_OFF_PITCH, pATIHW->src_off_pitch); + outf(SRC_Y_X, SetWord(pATIHW->src_x, 1) | SetWord(pATIHW->src_y, 0)); + outf(SRC_HEIGHT1_WIDTH1, SetWord(pATIHW->src_width1, 1) | SetWord(pATIHW->src_height1, 0)); - outm(SRC_Y_X_START, + outf(SRC_Y_X_START, SetWord(pATIHW->src_x_start, 1) | SetWord(pATIHW->src_y_start, 0)); - outm(SRC_HEIGHT2_WIDTH2, + outf(SRC_HEIGHT2_WIDTH2, SetWord(pATIHW->src_width2, 1) | SetWord(pATIHW->src_height2, 0)); - outm(SRC_CNTL, pATIHW->src_cntl); + outf(SRC_CNTL, pATIHW->src_cntl); /* Load host data register */ - ATIMach64WaitForFIFO(1); - outm(HOST_CNTL, pATIHW->host_cntl); + ATIMach64WaitForFIFO(pATI, 1); + outf(HOST_CNTL, pATIHW->host_cntl); + + /* Set host transfer window address and size clamp */ + pATI->pHOST_DATA = + (CARD8 *)pATI->pBlock[GetBits(HOST_DATA_0, BLOCK_SELECT)] + + (HOST_DATA_0 & MM_IO_SELECT); + pATI->nHostFIFOEntries = pATI->nFIFOEntries >> 1; + if (pATI->nHostFIFOEntries > 16) + pATI->nHostFIFOEntries = 16; /* Load pattern registers */ - ATIMach64WaitForFIFO(3); - outm(PAT_REG0, pATIHW->pat_reg0); - outm(PAT_REG1, pATIHW->pat_reg1); - outm(PAT_CNTL, pATIHW->pat_cntl); + ATIMach64WaitForFIFO(pATI, 3); + outf(PAT_REG0, pATIHW->pat_reg0); + outf(PAT_REG1, pATIHW->pat_reg1); + outf(PAT_CNTL, pATIHW->pat_cntl); /* Load scissor registers */ - ATIMach64WaitForFIFO(2); - outm(SC_LEFT_RIGHT, + ATIMach64WaitForFIFO(pATI, 2); + outf(SC_LEFT_RIGHT, SetWord(pATIHW->sc_right, 1) | SetWord(pATIHW->sc_left, 0)); - outm(SC_TOP_BOTTOM, + outf(SC_TOP_BOTTOM, SetWord(pATIHW->sc_bottom, 1) | SetWord(pATIHW->sc_top, 0)); + pATI->sc_left = pATIHW->sc_left; + pATI->sc_right = pATIHW->sc_right; + pATI->sc_top = pATIHW->sc_top; + pATI->sc_bottom = pATIHW->sc_bottom; /* Load data path registers */ - ATIMach64WaitForFIFO(7); - outm(DP_BKGD_CLR, pATIHW->dp_bkgd_clr); - outm(DP_FRGD_CLR, pATIHW->dp_frgd_clr); - outm(DP_WRITE_MASK, pATIHW->dp_write_mask); - outm(DP_CHAIN_MASK, pATIHW->dp_chain_mask); - outm(DP_PIX_WIDTH, pATIHW->dp_pix_width); - outm(DP_MIX, pATIHW->dp_mix); - outm(DP_SRC, pATIHW->dp_src); + ATIMach64WaitForFIFO(pATI, 7); + outf(DP_BKGD_CLR, pATIHW->dp_bkgd_clr); + outf(DP_FRGD_CLR, pATIHW->dp_frgd_clr); + outf(DP_WRITE_MASK, pATIHW->dp_write_mask); + outf(DP_CHAIN_MASK, pATIHW->dp_chain_mask); + outf(DP_PIX_WIDTH, pATIHW->dp_pix_width); + outf(DP_MIX, pATIHW->dp_mix); + outf(DP_SRC, pATIHW->dp_src); /* Load colour compare registers */ - ATIMach64WaitForFIFO(3); - outm(CLR_CMP_CLR, pATIHW->clr_cmp_clr); - outm(CLR_CMP_MSK, pATIHW->clr_cmp_msk); - outm(CLR_CMP_CNTL, pATIHW->clr_cmp_cntl); + ATIMach64WaitForFIFO(pATI, 3); + outf(CLR_CMP_CLR, pATIHW->clr_cmp_clr); + outf(CLR_CMP_MSK, pATIHW->clr_cmp_msk); + outf(CLR_CMP_CNTL, pATIHW->clr_cmp_cntl); /* Load context mask */ - ATIMach64WaitForFIFO(1); - outm(CONTEXT_MASK, pATIHW->context_mask); + ATIMach64WaitForFIFO(pATI, 1); + outf(CONTEXT_MASK, pATIHW->context_mask); - ATIMach64WaitForIdle(); + ATIMach64WaitForIdle(pATI); if (pATI->OptionMMIOCache) { @@ -774,14 +722,13 @@ ATIMach64Set } /* Aperture setup */ - outl(pATI->CPIO_BUS_CNTL, pATIHW->bus_cntl); - - outl(pATI->CPIO_MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); - outl(pATI->CPIO_MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); + outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); + outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); - outl(pATI->CPIO_DAC_CNTL, pATIHW->dac_cntl); + outr(DAC_CNTL, pATIHW->dac_cntl); - outl(pATI->CPIO_CONFIG_CNTL, pATIHW->config_cntl); + outr(CONFIG_CNTL, pATIHW->config_cntl); + outr(BUS_CNTL, pATIHW->bus_cntl); } /* @@ -796,18 +743,18 @@ ATIMach64SaveScreen int Mode ) { - CARD32 crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL); + CARD32 crtc_gen_cntl = inr(CRTC_GEN_CNTL); switch (Mode) { case SCREEN_SAVER_OFF: case SCREEN_SAVER_FORCER: - outl(pATI->CPIO_CRTC_GEN_CNTL, crtc_gen_cntl & ~CRTC_DISPLAY_DIS); + outr(CRTC_GEN_CNTL, crtc_gen_cntl & ~CRTC_DISPLAY_DIS); break; case SCREEN_SAVER_ON: case SCREEN_SAVER_CYCLE: - outl(pATI->CPIO_CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_DISPLAY_DIS); + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_DISPLAY_DIS); break; default: @@ -828,7 +775,7 @@ ATIMach64SetDPMSMode ) { CARD32 crtc_gen_cntl = - inl(pATI->CPIO_CRTC_GEN_CNTL) & ~(CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); + inr(CRTC_GEN_CNTL) & ~(CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); switch (DPMSMode) { @@ -851,20 +798,20 @@ ATIMach64SetDPMSMode return; } - outl(pATI->CPIO_CRTC_GEN_CNTL, crtc_gen_cntl); + outr(CRTC_GEN_CNTL, crtc_gen_cntl); if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT) { CARD32 lcd_index = 0, power_management; if (pATI->Chip == ATI_CHIP_264LT) - power_management = inl(pATI->CPIO_POWER_MANAGEMENT); + power_management = inr(POWER_MANAGEMENT); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - lcd_index = inl(pATI->CPIO_LCD_INDEX); - power_management = ATIGetLTProLCDReg(LCD_POWER_MANAGEMENT); + lcd_index = inr(LCD_INDEX); + power_management = ATIGetMach64LCDReg(LCD_POWER_MANAGEMENT); } power_management &= ~(STANDBY_NOW | SUSPEND_NOW); @@ -891,18 +838,51 @@ ATIMach64SetDPMSMode } if (pATI->Chip == ATI_CHIP_264LT) - outl(POWER_MANAGEMENT, power_management); + outr(POWER_MANAGEMENT, power_management); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) */ { - ATIPutLTProLCDReg(LCD_POWER_MANAGEMENT, power_management); - outl(pATI->CPIO_LCD_INDEX, lcd_index); + ATIPutMach64LCDReg(LCD_POWER_MANAGEMENT, power_management); + outr(LCD_INDEX, lcd_index); } } } /* + * ATIMach64ValidateClip -- + * + * This function ensures the current scissor settings do not interfere with + * the current draw request. + */ +static void +ATIMach64ValidateClip +( + ATIPtr pATI, + CARD16 sc_left, + CARD16 sc_right, + CARD16 sc_top, + CARD16 sc_bottom +) +{ + if ((sc_left < pATI->sc_left) || (sc_right > pATI->sc_right)) + { + outf(SC_LEFT_RIGHT, SetWord(pATI->NewHW.sc_right, 1) | + SetWord(pATI->NewHW.sc_left, 0)); + pATI->sc_left = pATI->NewHW.sc_left; + pATI->sc_right = pATI->NewHW.sc_right; + } + + if ((sc_top < pATI->sc_top) || (sc_bottom > pATI->sc_bottom)) + { + outf(SC_TOP_BOTTOM, SetWord(pATI->NewHW.sc_bottom, 1) | + SetWord(pATI->NewHW.sc_top, 0)); + pATI->sc_top = pATI->NewHW.sc_top; + pATI->sc_bottom = pATI->NewHW.sc_bottom; + } +} + +/* * ATIMach64Sync -- * * This is called to wait for the draw engine to become idle. @@ -915,7 +895,7 @@ ATIMach64Sync { ATIPtr pATI = ATIPTR(pScreenInfo); - ATIMach64WaitForIdle(); + ATIMach64WaitForIdle(pATI); if (pATI->OptionMMIOCache) { @@ -1075,14 +1055,14 @@ ATIMach64SetupForScreenToScreenCopy pATI->dst_cntl |= DST_X_DIR; if (pATI->XModifier == 1) - outm(DST_CNTL, pATI->dst_cntl); + outf(DST_CNTL, pATI->dst_cntl); else pATI->dst_cntl |= DST_24_ROT_EN; - ATIMach64WaitForFIFO(3); - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); - outm(DP_WRITE_MASK, planemask); - outm(DP_SRC, DP_MONO_SRC_ALLONES | + ATIMach64WaitForFIFO(pATI, 3); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); } @@ -1110,14 +1090,7 @@ ATIMach64SubsequentScreenToScreenCopy w *= pATI->XModifier; /* Disable clipping if it gets in the way */ - if ((xDst < (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 0)) || - ((xDst + w - 1) > (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 1))) - outm(SC_LEFT_RIGHT, SetWord(pATI->NewHW.sc_right, 1) | - SetWord(pATI->NewHW.sc_left, 0)); - if ((yDst < (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 0)) || - ((yDst + h - 1) > (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 1))) - outm(SC_TOP_BOTTOM, SetWord(pATI->NewHW.sc_bottom, 1) | - SetWord(pATI->NewHW.sc_top, 0)); + ATIMach64ValidateClip(pATI, xDst, xDst + w - 1, yDst, yDst + h - 1); if (!(pATI->dst_cntl & DST_X_DIR)) { @@ -1132,13 +1105,13 @@ ATIMach64SubsequentScreenToScreenCopy } if (pATI->XModifier != 1) - outm(DST_CNTL, pATI->dst_cntl | SetBits((xDst / 4) % 6, DST_24_ROT)); + outf(DST_CNTL, pATI->dst_cntl | SetBits((xDst / 4) % 6, DST_24_ROT)); - ATIMach64WaitForFIFO(4); - outm(SRC_Y_X, SetWord(xSrc, 1) | SetWord(ySrc, 0)); - outm(SRC_WIDTH1, w); - outm(DST_Y_X, SetWord(xDst, 1) | SetWord(yDst, 0)); - outm(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + ATIMach64WaitForFIFO(pATI, 4); + outf(SRC_Y_X, SetWord(xSrc, 1) | SetWord(ySrc, 0)); + outf(SRC_WIDTH1, w); + outf(DST_Y_X, SetWord(xDst, 1) | SetWord(yDst, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); } /* @@ -1158,14 +1131,14 @@ ATIMach64SetupForSolidFill ATIPtr pATI = ATIPTR(pScreenInfo); if (pATI->XModifier == 1) - outm(DST_CNTL, DST_X_DIR | DST_Y_DIR); + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); - ATIMach64WaitForFIFO(4); - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); - outm(DP_WRITE_MASK, planemask); - outm(DP_SRC, DP_MONO_SRC_ALLONES | + ATIMach64WaitForFIFO(pATI, 4); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outm(DP_FRGD_CLR, colour); + outf(DP_FRGD_CLR, colour); } /* @@ -1190,23 +1163,16 @@ ATIMach64SubsequentSolidFillRect x *= pATI->XModifier; w *= pATI->XModifier; - outm(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | + outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); } /* Disable clipping if it gets in the way */ - if ((x < (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 0)) || - ((x + w - 1) > (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 1))) - outm(SC_LEFT_RIGHT, SetWord(pATI->NewHW.sc_right, 1) | - SetWord(pATI->NewHW.sc_left, 0)); - if ((y < (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 0)) || - ((y + h - 1) > (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 1))) - outm(SC_TOP_BOTTOM, SetWord(pATI->NewHW.sc_bottom, 1) | - SetWord(pATI->NewHW.sc_top, 0)); + ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1); - ATIMach64WaitForFIFO(2); - outm(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); - outm(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); } /* @@ -1226,17 +1192,15 @@ ATIMach64SetupForSolidLine { ATIPtr pATI = ATIPTR(pScreenInfo); - ATIMach64WaitForFIFO(6); - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); - outm(DP_WRITE_MASK, planemask); - outm(DP_SRC, DP_MONO_SRC_ALLONES | + ATIMach64WaitForFIFO(pATI, 4); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outm(DP_FRGD_CLR, colour); + outf(DP_FRGD_CLR, colour); - outm(SC_LEFT_RIGHT, - SetWord(pATI->NewHW.sc_right, 1) | SetWord(pATI->NewHW.sc_left, 0)); - outm(SC_TOP_BOTTOM, - SetWord(pATI->NewHW.sc_bottom, 1) | SetWord(pATI->NewHW.sc_top, 0)); + ATIMach64ValidateClip(pATI, pATI->NewHW.sc_left, pATI->NewHW.sc_right, + pATI->NewHW.sc_top, pATI->NewHW.sc_bottom); } /* @@ -1257,14 +1221,14 @@ ATIMach64SubsequentSolidHorVertLine { ATIPtr pATI = ATIPTR(pScreenInfo); - ATIMach64WaitForFIFO(3); - outm(DST_CNTL, DST_X_DIR | DST_Y_DIR); - outm(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + ATIMach64WaitForFIFO(pATI, 3); + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); if (dir == DEGREES_0) - outm(DST_HEIGHT_WIDTH, SetWord(len, 1) | SetWord(1, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(len, 1) | SetWord(1, 0)); else /* if (dir == DEGREES_270) */ - outm(DST_HEIGHT_WIDTH, SetWord(1, 1) | SetWord(len, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(1, 1) | SetWord(len, 0)); } /* @@ -1297,13 +1261,13 @@ ATIMach64SubsequentSolidBresenhamLine if (!(octant & YDECREASING)) dst_cntl |= DST_Y_DIR; - ATIMach64WaitForFIFO(6); - outm(DST_CNTL, dst_cntl); - outm(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); - outm(DST_BRES_ERR, minor + err); - outm(DST_BRES_INC, minor); - outm(DST_BRES_DEC, minor - major); - outm(DST_BRES_LNTH, len); + ATIMach64WaitForFIFO(pATI, 6); + outf(DST_CNTL, dst_cntl); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_BRES_ERR, minor + err); + outf(DST_BRES_INC, minor); + outf(DST_BRES_DEC, minor - major); + outf(DST_BRES_LNTH, len); } /* @@ -1327,28 +1291,28 @@ ATIMach64SetupForMono8x8PatternFill ATIPtr pATI = ATIPTR(pScreenInfo); if (pATI->XModifier == 1) - outm(DST_CNTL, DST_X_DIR | DST_Y_DIR); + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); if (bg == -1) - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(MIX_DST, DP_BKGD_MIX)); else { - ATIMach64WaitForFIFO(2); - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | + ATIMach64WaitForFIFO(pATI, 2); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(ATIMach64ALU[rop], DP_BKGD_MIX)); - outm(DP_BKGD_CLR, bg); + outf(DP_BKGD_CLR, bg); } - ATIMach64WaitForFIFO(6); - outm(DP_WRITE_MASK, planemask); - outm(DP_SRC, DP_MONO_SRC_PATTERN | + ATIMach64WaitForFIFO(pATI, 6); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_PATTERN | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outm(DP_FRGD_CLR, fg); + outf(DP_FRGD_CLR, fg); - outm(PAT_REG0, patx); - outm(PAT_REG1, paty); - outm(PAT_CNTL, PAT_MONO_EN); + outf(PAT_REG0, patx); + outf(PAT_REG1, paty); + outf(PAT_CNTL, PAT_MONO_EN); } /* @@ -1375,23 +1339,16 @@ ATIMach64SubsequentMono8x8PatternFillRect x *= pATI->XModifier; w *= pATI->XModifier; - outm(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | + outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); } /* Disable clipping if it gets in the way */ - if ((x < (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 0)) || - ((x + w - 1) > (int)GetWord(CacheSlot(SC_LEFT_RIGHT), 1))) - outm(SC_LEFT_RIGHT, SetWord(pATI->NewHW.sc_right, 1) | - SetWord(pATI->NewHW.sc_left, 0)); - if ((y < (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 0)) || - ((y + h - 1) > (int)GetWord(CacheSlot(SC_TOP_BOTTOM), 1))) - outm(SC_TOP_BOTTOM, SetWord(pATI->NewHW.sc_bottom, 1) | - SetWord(pATI->NewHW.sc_top, 0)); + ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1); - ATIMach64WaitForFIFO(2); - outm(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); - outm(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); } /* @@ -1412,24 +1369,24 @@ ATIMach64SetupForScanlineCPUToScreenColorExpandFill ATIPtr pATI = ATIPTR(pScreenInfo); if (pATI->XModifier == 1) - outm(DST_CNTL, DST_X_DIR | DST_Y_DIR); + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); if (bg == -1) - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(MIX_DST, DP_BKGD_MIX)); else { - ATIMach64WaitForFIFO(2); - outm(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | + ATIMach64WaitForFIFO(pATI, 2); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(ATIMach64ALU[rop], DP_BKGD_MIX)); - outm(DP_BKGD_CLR, bg); + outf(DP_BKGD_CLR, bg); } - ATIMach64WaitForFIFO(3); - outm(DP_WRITE_MASK, planemask); - outm(DP_SRC, DP_MONO_SRC_HOST | + ATIMach64WaitForFIFO(pATI, 3); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_HOST | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outm(DP_FRGD_CLR, fg); + outf(DP_FRGD_CLR, fg); } /* @@ -1456,16 +1413,19 @@ ATIMach64SubsequentScanlineCPUToScreenColorExpandFill w *= pATI->XModifier; skipleft *= pATI->XModifier; - outm(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | + outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); } pATI->ExpansionBitmapWidth = (w + 31) / 32; - ATIMach64WaitForFIFO(3); - outm(SC_LEFT_RIGHT, SetWord(x + w - 1, 1) | SetWord(x + skipleft, 0)); - outm(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); - outm(DST_HEIGHT_WIDTH, + ATIMach64WaitForFIFO(pATI, 3); + pATI->sc_left = x + skipleft; + pATI->sc_right = x + w - 1; + outf(SC_LEFT_RIGHT, + SetWord(pATI->sc_right, 1) | SetWord(pATI->sc_left, 0)); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(pATI->ExpansionBitmapWidth * 32, 1) | SetWord(h, 0)); } @@ -1473,7 +1433,8 @@ ATIMach64SubsequentScanlineCPUToScreenColorExpandFill * ATIMach64SubsequentColorExpandScanline -- * * This function feeds a bitmap scanline to the engine for a colour expansion - * fill. + * fill. This is written to do burst transfers for those platforms that can do + * them, and to improve CPU/engine concurrency. */ static void ATIMach64SubsequentColorExpandScanline @@ -1482,22 +1443,69 @@ ATIMach64SubsequentColorExpandScanline int iBuffer ) { - ATIPtr pATI = ATIPTR(pScreenInfo); - CARD32 *pBitmapData = pATI->ExpansionBitmapScanline; - int w = pATI->ExpansionBitmapWidth; - int nFIFOEntries = pATI->nFIFOEntries; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer]; + CARD32 *pDst, *pSrc; + int w = pATI->ExpansionBitmapWidth; + int nDWord; + unsigned int iDWord; + + while (w > 0) + { + /* + * Transfers are done in chunks of up to 64 bytes in length (32 on + * earlier controllers). + */ + nDWord = w; + if (nDWord > pATI->nHostFIFOEntries) + nDWord = pATI->nHostFIFOEntries; - pATI->nFIFOEntries >>= 1; + /* Make enough FIFO slots available */ + ATIMach64WaitForFIFO(pATI, nDWord); - for (; w > 0; w--, pBitmapData++) - { - if (!pATI->nAvailableFIFOEntries && (w > 1)) - ATIMach64WaitForFIFO(w); + /* + * Always start transfers on a chuck-sized boundary. Note that + * HOST_DATA_0 is actually on a 512-byte boundary, but *pBitmapData can + * only be guaranteed to be on a chunk-sized boundary. + */ + iDWord = 16 - nDWord; + pDst = (CARD32 *)pATI->pHOST_DATA - iDWord; + pSrc = pBitmapData - iDWord; - outm(HOST_DATA_0, *pBitmapData); + /* + * Transfer current chunk. With any luck, the compiler won't mangle + * this too badly... + */ + switch (iDWord) + { + case 0: MMIO_OUT32(pDst + 0, 0, *(pSrc + 0)); + case 1: MMIO_OUT32(pDst + 1, 0, *(pSrc + 1)); + case 2: MMIO_OUT32(pDst + 2, 0, *(pSrc + 2)); + case 3: MMIO_OUT32(pDst + 3, 0, *(pSrc + 3)); + case 4: MMIO_OUT32(pDst + 4, 0, *(pSrc + 4)); + case 5: MMIO_OUT32(pDst + 5, 0, *(pSrc + 5)); + case 6: MMIO_OUT32(pDst + 6, 0, *(pSrc + 6)); + case 7: MMIO_OUT32(pDst + 7, 0, *(pSrc + 7)); + case 8: MMIO_OUT32(pDst + 8, 0, *(pSrc + 8)); + case 9: MMIO_OUT32(pDst + 9, 0, *(pSrc + 9)); + case 10: MMIO_OUT32(pDst + 10, 0, *(pSrc + 10)); + case 11: MMIO_OUT32(pDst + 11, 0, *(pSrc + 11)); + case 12: MMIO_OUT32(pDst + 12, 0, *(pSrc + 12)); + case 13: MMIO_OUT32(pDst + 13, 0, *(pSrc + 13)); + case 14: MMIO_OUT32(pDst + 14, 0, *(pSrc + 14)); + case 15: MMIO_OUT32(pDst + 15, 0, *(pSrc + 15)); + + default: /* Muffle compiler */ + break; + } + + /* Step to next chunk */ + pBitmapData += nDWord; + w -= nDWord; + pATI->nAvailableFIFOEntries -= nDWord; } - pATI->nFIFOEntries = nFIFOEntries; + pATI->EngineIsBusy = TRUE; } /* @@ -1517,8 +1525,16 @@ ATIMach64AccelInit if (pATI->XModifier == 1) { pXAAInfo->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS; + +#ifndef AVOID_CPIO + if (!pATI->BankInfo.BankSize) + +#endif /* AVOID_CPIO */ + + { pXAAInfo->Flags |= LINEAR_FRAMEBUFFER; + } } /* Sync */ @@ -1535,8 +1551,8 @@ ATIMach64AccelInit pXAAInfo->SubsequentSolidFillRect = ATIMach64SubsequentSolidFillRect; /* 8x8 mono pattern fills */ - pXAAInfo->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_MSBFIRST; + pXAAInfo->Mono8x8PatternFillFlags = + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN; pXAAInfo->SetupForMono8x8PatternFill = ATIMach64SetupForMono8x8PatternFill; pXAAInfo->SubsequentMono8x8PatternFillRect = ATIMach64SubsequentMono8x8PatternFillRect; @@ -1547,14 +1563,21 @@ ATIMach64AccelInit */ pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | - BIT_ORDER_IN_BYTE_MSBFIRST | CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD; + CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD; if (pATI->XModifier != 1) pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags |= TRIPLE_BITS_24BPP; pXAAInfo->NumScanlineColorExpandBuffers = 1; - pATI->ExpansionBitmapScanlinePtr = pATI->ExpansionBitmapScanline; + + /* Align bitmap data on a 64-byte boundary */ + pATI->ExpansionBitmapWidth = /* DWord size in bits */ + ((pATI->displayWidth * pATI->XModifier) + 31) & ~31U; + pATI->ExpansionBitmapScanlinePtr[1] = + (CARD32 *)xnfalloc((pATI->ExpansionBitmapWidth >> 3) + 63); + pATI->ExpansionBitmapScanlinePtr[0] = + (pointer)(((unsigned long)pATI->ExpansionBitmapScanlinePtr[1] + 63) & + ~63UL); pXAAInfo->ScanlineColorExpandBuffers = - (CARD8 **)&pATI->ExpansionBitmapScanlinePtr; + (CARD8 **)pATI->ExpansionBitmapScanlinePtr; pXAAInfo->SetupForScanlineCPUToScreenColorExpandFill = ATIMach64SetupForScanlineCPUToScreenColorExpandFill; pXAAInfo->SubsequentScanlineCPUToScreenColorExpandFill = diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h index 0cfa6e92b..8e53f2183 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.8 2000/06/19 15:00:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.9 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xaa.h" #define ATIMach64MaxX 8191 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c new file mode 100644 index 000000000..723e93a7d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c @@ -0,0 +1,100 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.2 2000/08/04 21:07:14 tsi Exp $ */ +/* + * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ati.h" +#include "atichip.h" +#include "atimach64io.h" + +/* + * ATIAccessMach64PLLReg -- + * + * This function sets up the addressing required to access, for read or write, + * a 264xT's PLL registers. + */ +void +ATIAccessMach64PLLReg +( + ATIPtr pATI, + const CARD8 Index, + const Bool Write +) +{ + CARD8 clock_cntl1 = in8(CLOCK_CNTL + 1) & + ~GetByte(PLL_WR_EN | PLL_ADDR, 1); + + /* Set PLL register to be read or written */ + out8(CLOCK_CNTL + 1, clock_cntl1 | + GetByte(SetBits(Index, PLL_ADDR) | SetBits(Write, PLL_WR_EN), 1)); +} + +/* + * ATIMach64PollEngineStatus -- + * + * This function refreshes the driver's view of the draw engine's status. This + * has been moved into a separate compilation unit to prevent inlining. + */ +void +ATIMach64PollEngineStatus +( + ATIPtr pATI +) +{ + CARD32 IOValue; + int Count; + + if (pATI->Chip < ATI_CHIP_264VTB) + { + /* + * TODO: Deal with locked engines. + */ + IOValue = inm(FIFO_STAT); + pATI->EngineIsLocked = GetBits(IOValue, FIFO_ERR); + + /* + * The following counts the number of bits in FIFO_STAT_BITS, and is + * derived from miSetVisualTypes() (formerly cfbSetVisualTypes()). + */ + IOValue = GetBits(IOValue, FIFO_STAT_BITS); + Count = (IOValue >> 1) & 0x36DBU; + Count = IOValue - Count - ((Count >> 1) & 0x36DBU); + Count = ((Count + (Count >> 3)) & 0x71C7U) % 0x3FU; + Count = pATI->nFIFOEntries - Count; + if (Count > pATI->nAvailableFIFOEntries) + pATI->nAvailableFIFOEntries = Count; + + /* + * If the command FIFO is non-empty, then the engine isn't idle. + */ + if (pATI->nAvailableFIFOEntries < pATI->nFIFOEntries) + { + pATI->EngineIsBusy = TRUE; + return; + } + } + + IOValue = inm(GUI_STAT); + pATI->EngineIsBusy = GetBits(IOValue, GUI_ACTIVE); + Count = GetBits(IOValue, GUI_FIFO); + if (Count > pATI->nAvailableFIFOEntries) + pATI->nAvailableFIFOEntries = Count; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h new file mode 100644 index 000000000..70e27ee8e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h @@ -0,0 +1,210 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.2 2000/08/04 21:07:14 tsi Exp $ */ +/* + * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE 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. + */ + +#ifndef ___ATIMACH64IO_H___ + +#if !defined(___ATI_H___) && defined(XFree86Module) +# error Missing #include "ati.h" before #include "atimach64io.h" +# undef XFree86Module +#endif + +#define ___ATIMACH64IO_H___ 1 + +#include "atiio.h" + +/* + * A few important notes on some of the I/O statements provided: + * + * inl/outl 32-bit R/W through PIO space. The register is specified as the + * actual PIO address. These are actually defined in compiler.h. + * + * inw/outw 16-bit counterparts to inl/outl. Not used for Mach64 support. + * + * inb/outb 8-bit counterparts to inl/outl. + * + * 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(). + * + * outf 32-bit write through MMIO cache. Identical to outm() but + * intended for FIFO'ed registers. There is no inf() provided. + * + * inr/outr 32-bit R/W through PIO or MMIO. Which one depends on the + * machine architecture. The register is specified as a IOPortTag + * from atiregs.h. Can only be used for registers in the first + * 256 bytes of MMIO space (in Block 0). Note that all of these + * registers are non-FIFO'ed. + * + * in8/out8 8-bit counterparts to inr/outr. + */ + +/* + * Cave canem (or it WILL bite you): All Mach64 non-VGA registers are + * ================================ little-endian, no matter how they are + * accessed (nor by what). + */ + +#define inm(_Register) \ + MMIO_IN32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ + (_Register) & MM_IO_SELECT) +#define outm(_Register, _Value) \ + MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ + (_Register) & MM_IO_SELECT, _Value) + +#ifdef AVOID_CPIO + +# define inr(_Register) \ + MMIO_IN32(pATI->pBlock[0], (_Register) & MM_IO_SELECT) +# define outr(_Register, _Value) \ + MMIO_OUT32(pATI->pBlock[0], (_Register) & MM_IO_SELECT, _Value) + +# define in8(_Register) \ + MMIO_IN8(pATI->pBlock[0], \ + (_Register) & (MM_IO_SELECT | IO_BYTE_SELECT)) +# define out8(_Register, _Value) \ + MMIO_OUT8(pATI->pBlock[0], \ + (_Register) & (MM_IO_SELECT | IO_BYTE_SELECT), _Value) + +/* Cause a cpp syntax error if any of these are used */ +#undef inb +#undef inw +#undef inl +#undef outb +#undef outw +#undef outl + +#define inb() /* Nothing */ +#define inw() /* Nothing */ +#define inl() /* Nothing */ +#define outb() /* Nothing */ +#define outw() /* Nothing */ +#define outl() /* Nothing */ + +#else /* AVOID_CPIO */ + +# define ATIIOPort(_PortTag) \ + (((pATI->CPIODecoding == SPARSE_IO) ? \ + ((_PortTag) & (SPARSE_IO_SELECT | IO_BYTE_SELECT)) : \ + ((_PortTag) & (BLOCK_IO_SELECT | IO_BYTE_SELECT))) | \ + pATI->CPIOBase) + +# define inr(_Register) \ + inl(ATIIOPort(_Register)) +# define outr(_Register, _Value) \ + outl(ATIIOPort(_Register), _Value) + +# define in8(_Register) \ + inb(ATIIOPort(_Register)) +# define out8(_Register, _Value) \ + outb(ATIIOPort(_Register), _Value) + +#endif /* AVOID_CPIO */ + +extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); + +/* + * MMIO cache definitions + */ +#define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register >> 3)] +#define CacheBit(___Register) (0x80U >> (CacheSlotOf(___Register) & 0x07U)) + +#define RegisterIsCached(__Register) \ + (CacheByte(__Register) & CacheBit(__Register)) +#define CacheSlot(__Register) pATI->MMIOCache[CacheSlotOf(__Register)] + +#define CacheRegister(__Register) \ + CacheByte(__Register) |= CacheBit(__Register) +#define UncacheRegister(__Register) \ + CacheByte(__Register) &= ~CacheBit(__Register) + +/* This would be quite a bit slower as a function */ +#define outf(_Register, _Value) \ + do \ + { \ + CARD32 _IOValue = (_Value); \ + \ + if (!RegisterIsCached(_Register) || \ + (_IOValue != CacheSlot(_Register))) \ + { \ + while (!pATI->nAvailableFIFOEntries--) \ + ATIMach64PollEngineStatus(pATI); \ + MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ + (_Register) & MM_IO_SELECT, _IOValue); \ + CacheSlot(_Register) = _IOValue; \ + pATI->EngineIsBusy = TRUE; \ + } \ + } while (0) + +/* + * This is no longer as critical, especially for _n == 1. However, + * there is still a need to ensure _n <= pATI-<nFIFOEntries. + */ +#define ATIMach64WaitForFIFO(_pATI, _n) \ + while (pATI->nAvailableFIFOEntries < (_n)) \ + ATIMach64PollEngineStatus(pATI); + +#define ATIMach64WaitForIdle(_pATI) \ + while (pATI->EngineIsBusy) \ + ATIMach64PollEngineStatus(pATI); + +extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, + const Bool)); + +#define ATIGetMach64PLLReg(_Index) \ + ( \ + ATIAccessMach64PLLReg(pATI, _Index, FALSE), \ + in8(CLOCK_CNTL + 2) \ + ) +#define ATIPutMach64PLLReg(_Index, _Value) \ + ( \ + ATIAccessMach64PLLReg(pATI, _Index, TRUE), \ + out8(CLOCK_CNTL + 2, _Value) \ + ) + +#define ATIGetMach64LCDReg(_Index) \ + ( \ + out8(LCD_INDEX, SetBits((_Index), LCD_REG_INDEX)), \ + inr(LCD_DATA) \ + ) +#define ATIPutMach64LCDReg(_Index, _Value) \ + ( \ + out8(LCD_INDEX, SetBits((_Index), LCD_REG_INDEX)), \ + outr(LCD_DATA, (_Value)) \ + ) + +#define ATIGetMach64TVReg(_Index) \ + ( \ + out8(TV_OUT_INDEX, SetBits((_Index), TV_REG_INDEX)), \ + inr(TV_OUT_DATA) \ + ) +#define ATIPutMach64TVReg(_Index, _Value) \ + ( \ + out8(TV_OUT_INDEX, SetBits((_Index), TV_REG_INDEX)), \ + outr(TV_OUT_DATA, (_Value)) \ + ) + +#endif /* ___ATIMACH64IO_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c index a334861f6..75e50abfc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.6 2000/06/19 15:00:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -70,8 +70,14 @@ ATISetup * refer to. */ LoaderRefSymbols( + +#ifndef AVOID_CPIO + "xf1bppScreenInit", "xf4bppScreenInit", + +#endif /* AVOID_CPIO */ + "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", @@ -149,12 +155,17 @@ ATILoadModules /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { + +#ifndef AVOID_CPIO + case 1: return ATILoadModule(pScreenInfo, "xf1bpp", "xf1bppScreenInit"); case 4: return ATILoadModule(pScreenInfo, "xf4bpp", "xf4bppScreenInit"); +#endif /* AVOID_CPIO */ + case 8: return ATILoadModule(pScreenInfo, "cfb", "cfbScreenInit"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h index 05e3f4472..f09f04a78 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.3 2000/02/18 12:19:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.4 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -21,13 +21,14 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#if defined(XFree86LOADER) && !defined(___ATI_MODULE_H___) -#define ___ATI_MODULE_H___ 1 +#if defined(XFree86LOADER) && !defined(___ATIMODULE_H___) +#define ___ATIMODULE_H___ 1 #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" extern Bool ATILoadModules FunctionPrototype((ScrnInfoPtr, ATIPtr)); -#endif +#endif /* ___ATIMODULE_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c index 8b30b41a0..0d9649dde 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.8 2000/05/03 00:44:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.9 2000/08/04 21:07:14 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -38,6 +38,7 @@ typedef enum ATI_OPTION_LINEAR, ATI_OPTION_MMIO_CACHE, ATI_OPTION_PROBE_CLOCKS, + ATI_OPTION_REFERENCE_CLOCK, ATI_OPTION_SHADOW_FB } ATIPublicOptionType; @@ -49,14 +50,69 @@ typedef enum static OptionInfoRec ATIPublicOptions[] = { - {ATI_OPTION_ACCEL, "accel", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_CRT, "crt_screen", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_CSYNC, "composite_sync", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_LINEAR, "linear", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_MMIO_CACHE, "mmio_cache", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_PROBE_CLOCKS, "probe_clocks", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_SHADOW_FB, "shadow_fb", OPTV_BOOLEAN, {0, }, FALSE}, - {-1, NULL, OPTV_NONE , {0, }, FALSE} + { + ATI_OPTION_ACCEL, + "accel", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_CRT, + "crt_screen", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_CSYNC, + "composite_sync", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_LINEAR, + "linear", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_MMIO_CACHE, + "mmio_cache", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_PROBE_CLOCKS, + "probe_clocks", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_REFERENCE_CLOCK, + "reference_clock", + OPTV_FREQ, + {0, }, + FALSE + }, + { + ATI_OPTION_SHADOW_FB, + "shadow_fb", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + -1, + NULL, + OPTV_NONE, + {0, }, + FALSE + } }; /* @@ -90,9 +146,27 @@ ATIProcessOptions OptionInfoRec PublicOption[NumberOf(ATIPublicOptions)]; OptionInfoRec PrivateOption[] = { - {ATI_OPTION_DEVEL, "tsi", OPTV_BOOLEAN, {0, }, FALSE}, - {ATI_OPTION_SYNC, "lcdsync", OPTV_BOOLEAN, {0, }, FALSE}, - {-1, NULL, OPTV_NONE , {0, }, FALSE} + { + ATI_OPTION_DEVEL, + "tsi", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + ATI_OPTION_SYNC, + "lcdsync", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { + -1, + NULL, + OPTV_NONE, + {0, }, + FALSE + } }; (void)memcpy(PublicOption, ATIPublicOptions, SizeOf(ATIPublicOptions)); @@ -107,14 +181,36 @@ ATIProcessOptions # define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool # define Sync PrivateOption[ATI_OPTION_SYNC].value.bool +# define ReferenceClock \ + PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq + /* Pick up XF86Config options */ xf86CollectOptions(pScreenInfo, NULL); /* Set non-zero defaults */ + +#ifndef AVOID_CPIO + if (pATI->Adapter >= ATI_ADAPTER_MACH64) + +#endif /* AVOID_CPIO */ + + { Accel = Linear = CacheMMIO = TRUE; + } + + ReferenceClock = ((double)157500000.0) / ((double)11.0); + +#ifndef AVOID_CPIO + if (pATI->BusType >= ATI_BUS_PCI) + +#endif /* AVOID_CPIO */ + + { ShadowFB = TRUE; + } + Sync = TRUE; xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, @@ -141,4 +237,27 @@ ATIProcessOptions pATI->OptionProbeClocks = ProbeClocks; pATI->OptionShadowFB = ShadowFB; pATI->OptionSync = Sync; + + /* Only set the reference clock if it hasn't already been determined */ + if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator) + { + switch ((int)(ReferenceClock / ((double)100000.0))) + { + case 143: + pATI->ReferenceNumerator = 157500; + pATI->ReferenceDenominator = 11; + break; + + case 286: + pATI->ReferenceNumerator = 315000; + pATI->ReferenceDenominator = 11; + break; + + default: + pATI->ReferenceNumerator = + (int)(ReferenceClock / ((double)1000.0)); + pATI->ReferenceDenominator = 1; + break; + } + } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h index a0fd69992..99189bfca 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.2 2000/02/18 12:19:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.3 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" extern OptionInfoPtr ATIAvailableOptions FunctionPrototype((int, int)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c index 73d5dc9dc..a3651de33 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.26 2000/06/19 15:00:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.28 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -31,14 +31,18 @@ #include "atiident.h" #include "atilock.h" #include "atimach64.h" +#include "atimach64io.h" #include "atimodule.h" #include "atioption.h" #include "atipreinit.h" #include "atiprint.h" #include "atividmem.h" + #include "vbe.h" #include "xf86RAC.h" +#ifndef AVOID_CPIO + typedef CARD16 Colour; /* The correct spelling should be OK :-) */ /* @@ -277,6 +281,8 @@ ATIMach32videoRam return Test_Case[Case_Number].videoRamSize; } +#endif /* AVOID_CPIO */ + /* * ATIReportMemory -- * @@ -295,6 +301,9 @@ ATIReportMemory Message = Buffer + snprintf(Buffer, SizeOf(Buffer), "%d kB of %s detected", pATI->VideoRAM, MemoryTypeName); + +#ifndef AVOID_CPIO + if (pATI->depth == 1) { /* 1bpp only uses one plane of four */ @@ -302,7 +311,11 @@ ATIReportMemory Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, " (using %d kB)", pScreenInfo->videoRam); } - else if (pATI->VideoRAM > pScreenInfo->videoRam) + else + +#endif /* AVOID_CPIO */ + + if (pATI->VideoRAM > pScreenInfo->videoRam) Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, " (using %d kB)", pScreenInfo->videoRam); xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); @@ -314,6 +327,24 @@ static const rgb defaultWeight = {0, 0, 0}; static const Gamma defaultGamma = {0.0, 0.0, 0.0}; /* + * ATIMapMach64 -- + * + * This function attempts to mmap() a Mach64's MMIO aperture. + */ +static void +ATIMapMach64 +( + int iScreen, + ATIPtr pATI +) +{ + (void)ATIMapApertures(iScreen, pATI); + if (!pATI->pBlock[0] || + (pATI->config_chip_id != inr(CONFIG_CHIP_ID))) + ATIUnmapApertures(iScreen, pATI); +} + +/* * ATIPreInit -- * * This function is only called once per screen at the start of the first @@ -327,11 +358,11 @@ ATIPreInit ) { # define BIOS_SIZE 0x00010000U /* 64kB */ - CARD8 BIOS[BIOS_SIZE], *pBIOS; + CARD8 BIOS[BIOS_SIZE]; # define BIOSByte(_n) (*((CARD8 *)(BIOS + (_n)))) # define BIOSWord(_n) (*((CARD16 *)(BIOS + (_n)))) # define BIOSLong(_n) (*((CARD32 *)(BIOS + (_n)))) - unsigned int BIOSSize; + unsigned int BIOSSize = 0; unsigned int ROMTable = 0, ClockTable = 0, FrequencyTable = 0; unsigned int LCDTable = 0, LCDPanelInfo = 0; @@ -340,21 +371,27 @@ ATIPreInit GDevPtr pGDev; EntityInfoPtr pEntity; resPtr pResources; + pciVideoPtr pVideo; DisplayModePtr pMode; - xf86Int10InfoPtr pInt10Info; + xf86Int10InfoPtr pInt10Info = NULL; vbeInfoPtr pVBE; - xf86MonPtr pMonitor = NULL; - pointer pInt10Module, pDDCModule, pVBEModule = NULL; - Bool AllowCRT = TRUE; - CARD32 IOValue1, IOValue2 = 0; - int i, j, AcceleratorVideoRAM = 0, VGAVideoRAM = 0; + pointer pInt10Module, pDDCModule = NULL, pVBEModule = NULL; + CARD32 IOValue1, IOValue2 = 0, IOValue3 = 0, IOValue4 = 0; + int i, j, AcceleratorVideoRAM = 0; int Numerator, Denominator; int MinX, MinY; - resRange Resources[2] = {{0, 0, 0}, _END}; ClockRange ATIClockRange = {NULL, 0, 80000, 0, TRUE, TRUE, 1, 1, 0}; int minPitch, maxPitch = 0xFFU, maxHeight = 0; + int ApertureSize = 0x00010000U; LookupModeFlags Strategy = LOOKUP_CLOSEST_CLOCK; +#ifndef AVOID_CPIO + + int VGAVideoRAM = 0; + resRange Resources[2] = {{0, 0, 0}, _END}; + +#endif /* AVOID_CPIO */ + if (pScreenInfo->numEntities != 1) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, @@ -371,57 +408,70 @@ ATIPreInit return FALSE; } - /* - * Get adapter BIOS, after ensuring its initialisation entry point has been - * executed. - */ - if (!(pInt10Module = xf86LoadSubModule(pScreenInfo, "int10"))) + /* Register resources */ + pEntity = xf86GetEntityInfo(pScreenInfo->entityList[0]); + pGDev = pEntity->device; + pResources = pEntity->resources; + xfree(pEntity); + if (!pResources) + pResources = xf86RegisterResources(pATI->iEntity, NULL, + pATI->SharedAccelerator ? ResShared : ResExclusive); + if (pResources) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to load int10 module.\n"); + "Unable to register the following bus resources:\n"); + xf86PrintResList(0, pResources); + xf86FreeResList(pResources); return FALSE; } - if (!(pInt10Info = xf86InitInt10(pATI->iEntity))) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to initialise int10 interface.\n"); - xf86UnloadSubModule(pInt10Module); - return FALSE; - } + ConfiguredMonitor = NULL; - if (!(pDDCModule = xf86LoadSubModule(pScreenInfo, "ddc"))) + /* + * If there is an ix86-style BIOS, ensure its initialisation entry point + * has been executed, and retrieve DDC and VBE information from it. + */ + (void)memset(BIOS, 0, SizeOf(BIOS)); + if (!(pInt10Module = xf86LoadSubModule(pScreenInfo, "int10"))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Unable to load ddc module.\n"); - else if (!(pVBEModule = xf86LoadSubModule(pScreenInfo, "vbe"))) + "Unable to load int10 module.\n"); + else if (!(pInt10Info = xf86InitInt10(pATI->iEntity))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Unable to load vbe module.\n"); + "Unable to initialise int10 interface.\n"); else { - if ((pVBE = VBEInit(pInt10Info, pATI->iEntity))) - pMonitor = vbeDoEDID(pVBE, pDDCModule); - vbeFree(pVBE); - xf86UnloadSubModule(pVBEModule); - } + if (!(pDDCModule = xf86LoadSubModule(pScreenInfo, "ddc"))) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to load ddc module.\n"); + else if (!(pVBEModule = xf86LoadSubModule(pScreenInfo, "vbe"))) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to load vbe module.\n"); + else + { + if ((pVBE = VBEInit(pInt10Info, pATI->iEntity))) + { + ConfiguredMonitor = vbeDoEDID(pVBE, pDDCModule); + vbeFree(pVBE); + } + xf86UnloadSubModule(pVBEModule); + } - /* - * Validate, then make a private copy of, the initialised BIOS. This - * allows de-activating int10 early. - */ - pBIOS = xf86int10Addr(pInt10Info, pInt10Info->BIOSseg << 4); - if ((pBIOS[0] != 0x55U) || (pBIOS[1] != 0xAAU) || !pBIOS[2]) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to correctly retrieve adapter BIOS.\n"); - xf86FreeInt10(pInt10Info); - xf86UnloadSubModule(pInt10Module); - return FALSE; - } + if (!(flags & PROBE_DETECT)) + { + /* Validate, then make a private copy of, the initialised BIOS */ + CARD8 *pBIOS = xf86int10Addr(pInt10Info, pInt10Info->BIOSseg << 4); - BIOSSize = pBIOS[2] << 9; - (void)memcpy(BIOS, pBIOS, BIOSSize); - if (BIOSSize < SizeOf(BIOS)) - (void)memset(BIOS + BIOSSize, 0, SizeOf(BIOS) - BIOSSize); + if ((pBIOS[0] != 0x55U) || (pBIOS[1] != 0xAAU) || + !pBIOS[2] || (pBIOS[2] > 0x80U)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to correctly retrieve adapter BIOS.\n"); + else + { + BIOSSize = pBIOS[2] << 9; + (void)memcpy(BIOS, pBIOS, BIOSSize); + } + } + } /* De-activate int10 */ xf86FreeInt10(pInt10Info); @@ -429,42 +479,33 @@ ATIPreInit if (flags & PROBE_DETECT) { - ConfiguredMonitor = pMonitor; xf86UnloadSubModule(pDDCModule); return TRUE; } - /* Register resources */ - pEntity = xf86GetEntityInfo(pScreenInfo->entityList[0]); - pGDev = pEntity->device; - pResources = pEntity->resources; - xfree(pEntity); - if (!pResources) - pResources = xf86RegisterResources(pATI->iEntity, NULL, - pATI->SharedAccelerator ? ResShared : ResExclusive); - if (pResources) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to register the following bus resources:\n"); - xf86PrintResList(0, pResources); - xf86FreeResList(pResources); - return FALSE; - } - - pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT; - pScreenInfo->racMemFlags = RAC_FB; - /* Set monitor */ pScreenInfo->monitor = pScreenInfo->confScreen->monitor; + xf86PrintEDID(ConfiguredMonitor); + xf86SetDDCproperties(pScreenInfo, ConfiguredMonitor); + + /* DDC module is no longer needed at this point */ + xf86UnloadSubModule(pDDCModule); - if (pMonitor) + pATI->Block0Base = 0; /* Might no longer be valid */ + if ((pVideo = pATI->PCIInfo)) { - xf86PrintEDID(pMonitor); - xf86SetDDCproperties(pScreenInfo, pMonitor); + ATIRefreshPCIBases(pVideo, pVideo->thisCard); + + if (pATI->CPIODecoding == BLOCK_IO) + pATI->CPIOBase = pVideo->ioBase[1]; + + /* Set MMIO address from PCI configuration space, if available */ + if ((pATI->Block0Base = pVideo->memBase[2])) + pATI->Block0Base += 0x0400U; } - /* DDC module is no longer needed at this point */ - xf86UnloadSubModule(pDDCModule); + pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT; + pScreenInfo->racMemFlags = RAC_FB; /* Deal with ChipID & ChipRev overrides */ if (pGDev->chipID >= 0) @@ -501,19 +542,26 @@ ATIPreInit /* Finish private area initialisation */ pATI->DAC = ATI_DAC_GENERIC; + +#ifndef AVOID_CPIO + pATI->NewHW.SetBank = ATIx8800SetBank; pATI->BankInfo.SetSourceBank = ATIx8800SetRead; pATI->BankInfo.SetDestinationBank = ATIx8800SetWrite; pATI->BankInfo.SetSourceAndDestinationBanks = ATIx8800SetReadWrite; pATI->BankInfo.BankSize = 0x00010000U; /* 64kB */ - pATI->ApertureBase = 0x000A0000U; - pATI->ApertureSize = 0x00010000U; + +#endif /* AVOID_CPIO */ + pATI->LCDPanelID = -1; pATI->nFIFOEntries = 16; /* For now */ /* Finish probing the adapter */ switch (pATI->Adapter) { + +#ifndef AVOID_CPIO + case ATI_ADAPTER_NONE: case ATI_ADAPTER_EGA: case ATI_ADAPTER_EGA_PLUS: @@ -573,25 +621,73 @@ ATIPreInit break; +#endif /* AVOID_CPIO */ + case ATI_ADAPTER_MACH64: - /* Set I/O port addresses */ - pATI->CPIO_CRTC_H_TOTAL_DISP = ATIIOPort(CRTC_H_TOTAL_DISP); - pATI->CPIO_CRTC_H_SYNC_STRT_WID = ATIIOPort(CRTC_H_SYNC_STRT_WID); - pATI->CPIO_CRTC_V_TOTAL_DISP = ATIIOPort(CRTC_V_TOTAL_DISP); - pATI->CPIO_CRTC_V_SYNC_STRT_WID = ATIIOPort(CRTC_V_SYNC_STRT_WID); - pATI->CPIO_CRTC_OFF_PITCH = ATIIOPort(CRTC_OFF_PITCH); - pATI->CPIO_CRTC_INT_CNTL = ATIIOPort(CRTC_INT_CNTL); - pATI->CPIO_CRTC_GEN_CNTL = ATIIOPort(CRTC_GEN_CNTL); - pATI->CPIO_OVR_CLR = ATIIOPort(OVR_CLR); - pATI->CPIO_OVR_WID_LEFT_RIGHT = ATIIOPort(OVR_WID_LEFT_RIGHT); - pATI->CPIO_OVR_WID_TOP_BOTTOM = ATIIOPort(OVR_WID_TOP_BOTTOM); - pATI->CPIO_CLOCK_CNTL = ATIIOPort(CLOCK_CNTL); - pATI->CPIO_MEM_INFO = ATIIOPort(MEM_INFO); - pATI->CPIO_DAC_REGS = ATIIOPort(DAC_REGS); - pATI->CPIO_DAC_CNTL = ATIIOPort(DAC_CNTL); - pATI->CPIO_CONFIG_CNTL = ATIIOPort(CONFIG_CNTL); - - IOValue1 = inl(pATI->CPIO_MEM_INFO); + /* Find and mmap() MMIO area */ + do + { + /* Only allow auxiliary aperture if it exists */ + if (!pATI->Block0Base) + { + if (pVideo) + { + /* Check tail end of linear (8MB or 4MB) aperture */ + if ((pATI->Block0Base = pVideo->memBase[0])) + { + pATI->Block0Base += 0x007FFC00U; + ATIMapMach64(pScreenInfo->scrnIndex, pATI); + if (pATI->pBlock[0]) + break; + + pATI->Block0Base -= 0x00400000U; + ATIMapMach64(pScreenInfo->scrnIndex, pATI); + if (pATI->pBlock[0]) + break; + } + } + + /* Check VGA MMIO aperture */ + pATI->Block0Base = 0x000BFC00U; + } + + ATIMapMach64(pScreenInfo->scrnIndex, pATI); + } while(0); + +#ifdef AVOID_CPIO + + if (!pATI->pBlock[0]) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to mmap() adapter registers.\n"); + return FALSE; + } + +#endif /* AVOID_CPIO */ + + IOValue1 = inr(CRTC_GEN_CNTL); + if (!(IOValue1 & CRTC_EN)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Adapter has not been initialised.\n"); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + +#ifdef AVOID_CPIO + + if (!(IOValue1 & CRTC_EXT_DISP_EN)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Adapters found to be in VGA mode on server entry are not" + " supported by the MMIO-only version of this driver.\n"); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + +#endif /* AVOID_CPIO */ + + IOValue1 = inr(MEM_CNTL); if (pATI->Chip < ATI_CHIP_264VTB) pATI->VideoRAM = videoRamSizes[GetBits(IOValue1, CTL_MEM_SIZE) + 2]; @@ -609,9 +705,9 @@ ATIPreInit pATI->VideoRAM = (IOValue1 - 7) * 2048; } - pATI->DAC = GetBits(inl(pATI->CPIO_DAC_CNTL), DAC_TYPE); + pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE); - IOValue1 = inl(ATIIOPort(CONFIG_STATUS64_0)); + IOValue1 = inr(CONFIG_STATUS64_0); if (pATI->Chip >= ATI_CHIP_264CT) { pATI->MemoryType = GetBits(IOValue1, CFG_MEM_TYPE_T); @@ -621,12 +717,9 @@ ATIPreInit { pATI->LCDPanelID = GetBits(IOValue1, CFG_PANEL_ID); - pATI->CPIO_HORZ_STRETCHING = ATIIOPort(HORZ_STRETCHING); - pATI->CPIO_VERT_STRETCHING = ATIIOPort(VERT_STRETCHING); - pATI->CPIO_LCD_GEN_CTRL = ATIIOPort(LCD_GEN_CTRL); - pATI->CPIO_POWER_MANAGEMENT = ATIIOPort(POWER_MANAGEMENT); - - IOValue2 = inl(pATI->CPIO_LCD_GEN_CTRL); + IOValue2 = inr(HORZ_STRETCHING); + IOValue3 = inr(VERT_STRETCHING); + IOValue4 = inr(LCD_GEN_CTRL); } else if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || @@ -634,40 +727,42 @@ ATIPreInit { pATI->LCDPanelID = GetBits(IOValue1, CFG_PANEL_ID); - pATI->CPIO_TV_OUT_INDEX = ATIIOPort(TV_OUT_INDEX); - pATI->CPIO_TV_OUT_DATA = ATIIOPort(TV_OUT_DATA); - pATI->CPIO_LCD_INDEX = ATIIOPort(LCD_INDEX); - pATI->CPIO_LCD_DATA = ATIIOPort(LCD_DATA); - - IOValue1 = inl(pATI->CPIO_LCD_INDEX); - IOValue2 = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING); -#if 0 - if (IOValue2 & AUTO_HORZ_RATIO) -#endif - pATI->LCDHorizontal = - (GetBits(IOValue2, HORZ_PANEL_SIZE) + 1) << 3; - IOValue2 = ATIGetLTProLCDReg(LCD_EXT_VERT_STRETCH); -#if 0 - if (IOValue2 & AUTO_VERT_RATIO) -#endif - pATI->LCDVertical = - GetBits(IOValue2, VERT_PANEL_SIZE) + 1; - IOValue2 = ATIGetLTProLCDReg(LCD_GEN_CNTL); - outl(pATI->CPIO_LCD_INDEX, IOValue1); + IOValue1 = inr(LCD_INDEX); + IOValue2 = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); + pATI->LCDHorizontal = GetBits(IOValue2, HORZ_PANEL_SIZE); + if (pATI->LCDHorizontal) + { + if (pATI->LCDHorizontal == MaxBits(HORZ_PANEL_SIZE)) + pATI->LCDHorizontal = 0; + else + pATI->LCDHorizontal = + (pATI->LCDHorizontal + 1) << 3; + } + IOValue3 = ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); + pATI->LCDVertical = GetBits(IOValue3, VERT_PANEL_SIZE); + if (pATI->LCDVertical) + { + if (pATI->LCDVertical == MaxBits(VERT_PANEL_SIZE)) + pATI->LCDVertical = 0; + else + pATI->LCDVertical++; + } + IOValue3 = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); + IOValue4 = ATIGetMach64LCDReg(LCD_GEN_CNTL); + outr(LCD_INDEX, IOValue1); } - if (pATI->LCDPanelID >= 0) - { - /* - * Don't bother with panel support if it's not enabled by - * BIOS initialisation. Also, remember if the BIOS knows - * about the CRT. - */ - if (!(IOValue2 & LCD_ON)) + /* + * Don't bother with panel support if it hasn't been previously + * enabled. + */ + if ((pATI->LCDPanelID >= 0) && + !pATI->LCDHorizontal && + !pATI->LCDVertical && + !(IOValue2 & HORZ_STRETCH_EN) && + !(IOValue3 & VERT_STRETCH_EN) && + !(IOValue4 & LCD_ON)) pATI->LCDPanelID = -1; - else if (!(IOValue2 & CRT_ON)) - AllowCRT = FALSE; - } } else { @@ -675,8 +770,7 @@ ATIPreInit /* Factor in what the BIOS says the DAC is */ pATI->DAC = ATI_DAC(pATI->DAC, - GetBits(inl(ATIIOPort(SCRATCH_REG1)), - BIOS_INIT_DAC_SUBTYPE)); + GetBits(inr(SCRATCH_REG1), BIOS_INIT_DAC_SUBTYPE)); } /* @@ -696,7 +790,13 @@ ATIPreInit * For Mach64 adapters, pick up, from the BIOS, the type of programmable * clock generator (if any), and various information about it. */ + +#ifndef AVOID_CPIO + if (pATI->Chip >= ATI_CHIP_88800GXC) + +#endif /* AVOID_CPIO */ + { CARD16 ClockDac; @@ -724,9 +824,6 @@ ATIPreInit pATI->BIOSClocks[i] = (&BIOSWord(FrequencyTable))[i]; pATI->ProgrammableClock = BIOSByte(ClockTable); pATI->ClockNumberToProgramme = BIOSByte(ClockTable + 0x06U); - if (pATI->ProgrammableClock < ATI_CLOCK_MAX) - pATI->ClockDescriptor = - ATIClockDescriptors[pATI->ProgrammableClock]; switch (BIOSWord(ClockTable + 0x08U) / 10) { case 143: @@ -746,6 +843,45 @@ ATIPreInit break; } } + else + { + /* + * Compensate for BIOS absence. Note that the reference + * frequency will be set later by option processing. + */ + if ((pATI->DAC & 0x0FU) == ATI_DAC_INTERNAL) + pATI->ProgrammableClock = ATI_CLOCK_INTERNAL; + else switch (pATI->DAC) + { + case ATI_DAC_STG1703: + pATI->ProgrammableClock = ATI_CLOCK_STG1703; + break; + + case ATI_DAC_CH8398: + pATI->ProgrammableClock = ATI_CLOCK_CH8398; + break; + + case ATI_DAC_ATT20C408: + pATI->ProgrammableClock = ATI_CLOCK_ATT20C408; + break; + + case ATI_DAC_IBMRGB514: + pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514; + break; + + default: /* Provisional */ + pATI->ProgrammableClock = ATI_CLOCK_ICS2595; + break; + } + + /* This should be safe for all generators except IBM's RGB514 */ + pATI->ClockNumberToProgramme = 3; + } + + if ((pATI->ProgrammableClock > ATI_CLOCK_FIXED) && + (pATI->ProgrammableClock < ATI_CLOCK_MAX)) + pATI->ClockDescriptor = + ATIClockDescriptors[pATI->ProgrammableClock]; ClockDac = pATI->DAC; switch (pATI->ProgrammableClock) @@ -756,8 +892,17 @@ ATIPreInit * revision level. */ if (ClockTable > 0) - pATI->ClockDescriptor.MinM = pATI->ClockDescriptor.MaxM = - BIOSWord(ClockTable + 0x0AU); + pATI->ClockDescriptor.MinM = + pATI->ClockDescriptor.MaxM = + BIOSWord(ClockTable + 0x0AU); + else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-0")) + pATI->ClockDescriptor.MinM = + pATI->ClockDescriptor.MaxM = 43; + else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-1")) + pATI->ClockDescriptor.MinM = + pATI->ClockDescriptor.MaxM = 46; + else + pATI->ProgrammableClock = ATI_CLOCK_UNKNOWN; break; case ATI_CLOCK_STG1703: @@ -869,15 +1014,12 @@ ATIPreInit } /* ... verify panel width ... */ - if ((pATI->LCDHorizontal > 8) && - (pATI->LCDHorizontal <= - (int)(MaxBits(HORZ_PANEL_SIZE) << 3)) && + if (pATI->LCDHorizontal && (pATI->LCDHorizontal != BIOSWord(i + 0x19U))) continue; /* ... and verify panel height */ - if ((pATI->LCDVertical > 1) && - (pATI->LCDVertical <= (int)MaxBits(VERT_PANEL_SIZE)) && + if (pATI->LCDVertical && (pATI->LCDVertical != BIOSWord(i + 0x1BU))) continue; @@ -903,42 +1045,17 @@ ATIPreInit if (LCDPanelInfo > 0) { - CARD8 ClockMask, PostMask; - pATI->LCDPanelID = BIOSByte(LCDPanelInfo); pATI->LCDHorizontal = BIOSWord(LCDPanelInfo + 0x19U); pATI->LCDVertical = BIOSWord(LCDPanelInfo + 0x1BU); - - /* Get clock number */ - if (inl(pATI->CPIO_CRTC_GEN_CNTL) & CRTC_EXT_DISP_EN) - i = inl(pATI->CPIO_CLOCK_CNTL) & 0x03U; - else - i = (inb(R_GENMO) & 0x0CU) >> 2; - - /* - * Get post divider. A GCC bug has caused the following - * expression to be broken down into its individual - * components. - */ - ClockMask = PLL_VCLK0_XDIV << i; - PostMask = PLL_VCLK0_POST_DIV << (i * 2); - j = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); - j *= MaxBits(PLL_VCLK0_POST_DIV) + 1; - j |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); - - /* Calculate clock of mode on entry */ - Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + i) * - pATI->ReferenceNumerator; - Denominator = pATI->ClockDescriptor.MinM * - pATI->ReferenceDenominator * - pATI->ClockDescriptor.PostDividers[j]; - pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0); } } } ATIUnlock(pATI); /* Unlock registers */ +#ifndef AVOID_CPIO + /* Sometimes, the BIOS lies about the chip */ if ((pATI->Chip >= ATI_CHIP_28800_4) && (pATI->Chip <= ATI_CHIP_28800_6)) { @@ -948,6 +1065,8 @@ ATIPreInit pATI->Chip = IOValue1; } +#endif /* AVOID_CPIO */ + /* Report what was found */ xf86DrvMsg(pScreenInfo->scrnIndex, pATI->Chipset ? X_CONFIG : X_DEFAULT, "Chipset: \"%s\".\n", ATIChipsetNames[pATI->Chipset]); @@ -955,7 +1074,12 @@ ATIPreInit xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s graphics controller detected.\n", ATIChipNames[pATI->Chip]); +#ifndef AVOID_CPIO + if ((pATI->Chip >= ATI_CHIP_68800) && (pATI->Chip != ATI_CHIP_68800_3)) + +#endif /* AVOID_CPIO */ + { Message = Buffer + snprintf(Buffer, SizeOf(Buffer), "Chip type %04X", pATI->ChipType); @@ -977,18 +1101,34 @@ ATIPreInit Buffer, pATI->ChipClass, pATI->ChipRevision); } +#ifndef AVOID_CPIO + if (pATI->Adapter >= ATI_ADAPTER_MACH8) + +#endif /* AVOID_CPIO */ + { Message = Buffer + snprintf(Buffer, SizeOf(Buffer), "%s bus interface detected", ATIBusNames[pATI->BusType]); + +#ifndef AVOID_CPIO + if (pATI->Adapter >= ATI_ADAPTER_MACH64) + +#endif /* AVOID_CPIO */ + + { Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, "; %s I/O base is 0x%04X", (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", pATI->CPIOBase); + } + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); } +#ifndef AVOID_CPIO + if (pATI->CPIO_VGAWonder) xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "VGA Wonder registers at I/O port 0x%04X.\n", @@ -1000,6 +1140,8 @@ ATIPreInit " memory.\n", ATIChipNames[pATI->Coprocessor], pATI->VideoRAM); +#endif /* AVOID_CPIO */ + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s adapter detected.\n", ATIAdapterNames[pATI->Adapter]); @@ -1028,37 +1170,12 @@ ATIPreInit } } - if (pATI->LCDPanelID >= 0) - { - if (LCDPanelInfo <= 0) - { - xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_ERROR, 0, - "Unable to determine dimensions of panel (ID %d).\n", - pATI->LCDPanelID); - ATILock(pATI); - return FALSE; - } - - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%dx%d panel (ID %d) detected.\n", - pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID); - for (i = 0; i < 24; i++) - Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i); - for (i = 24; --i >= 0; ) - if (Buffer[i] != ' ') - { - Buffer[i + 1] = '\0'; - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "Panel model %s.\n", Buffer); - break; - } - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "Panel clock is %.3f MHz.\n", (double)(pATI->LCDClock) / 1000.0); - } - /* Promote chipset specification */ switch (pATI->Chipset) { + +#ifndef AVOID_CPIO + case ATI_CHIPSET_IBMVGA: if (pATI->Adapter == ATI_ADAPTER_VGA) break; /* XXX */ @@ -1075,6 +1192,9 @@ ATIPreInit case ATI_CHIPSET_MACH8: case ATI_CHIPSET_MACH32: + +#endif /* AVOID_CPIO */ + case ATI_CHIPSET_MACH64: case ATI_CHIPSET_RAGE128: pATI->Chipset = ATI_CHIPSET_ATI; @@ -1093,11 +1213,22 @@ ATIPreInit else i = Support24bppFb | Support32bppFb; if (!xf86SetDepthBpp(pScreenInfo, 8, 8, 8, i)) + { + ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; + } switch (pScreenInfo->depth) { - case 1: case 4: case 8: case 15: case 16: case 24: + +#ifndef AVOID_CPIO + + case 1: case 4: + +#endif /* AVOID_CPIO */ + + case 8: case 15: case 16: case 24: break; default: @@ -1105,6 +1236,7 @@ ATIPreInit "Driver does not support depth %d.\n", pScreenInfo->depth); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1116,6 +1248,7 @@ ATIPreInit "Depth %d is not supported through this adapter.\n", pScreenInfo->depth); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1125,6 +1258,19 @@ ATIPreInit ATIProcessOptions(pScreenInfo, pATI); +#ifdef AVOID_CPIO + + if (!pATI->OptionLinear) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "A linear aperture is not available in this configuration.\n"); + ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + +#endif /* AVOID_CPIO */ + /* * Set colour weights. */ @@ -1137,6 +1283,7 @@ ATIPreInit if (!xf86SetWeight(pScreenInfo, defaultWeight, defaultWeight)) { ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1152,6 +1299,7 @@ ATIPreInit pScreenInfo->weight.red, pScreenInfo->weight.green, pScreenInfo->weight.blue, pScreenInfo->depth); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1162,6 +1310,7 @@ ATIPreInit if (!xf86SetDefaultVisual(pScreenInfo, -1)) { ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1175,6 +1324,7 @@ ATIPreInit xf86GetVisualName(pScreenInfo->defaultVisual), pScreenInfo->depth); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1182,10 +1332,19 @@ ATIPreInit * Set colour gamma. */ - if ((pScreenInfo->depth > 1) && !xf86SetGamma(pScreenInfo, defaultGamma)) +#ifndef AVOID_CPIO + + if (pScreenInfo->depth > 1) + +#endif /* AVOID_CPIO */ + { - ATILock(pATI); - return FALSE; + if (!xf86SetGamma(pScreenInfo, defaultGamma)) + { + ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } } pATI->depth = pScreenInfo->depth; @@ -1197,15 +1356,22 @@ ATIPreInit * Determine which CRT controller to use for video modes. */ +#ifndef AVOID_CPIO + if ((pATI->Chip >= ATI_CHIP_88800GXC) && (pATI->depth >= 8) && (pATI->Chipset == ATI_CHIPSET_ATI)) + +#endif /* AVOID_CPIO */ + { pATI->NewHW.crtc = ATI_CRTC_MACH64; xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using Mach64 accelerator CRTC.\n"); +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { /* @@ -1234,7 +1400,13 @@ ATIPreInit } } } + +#endif /* AVOID_CPIO */ + } + +#ifndef AVOID_CPIO + else { pATI->NewHW.crtc = ATI_CRTC_VGA; @@ -1252,6 +1424,7 @@ ATIPreInit xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "VGA is not available through this adapter.\n"); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1265,27 +1438,106 @@ ATIPreInit } } +#endif /* AVOID_CPIO */ + /* * Decide between the CRT and the panel. */ if (pATI->LCDPanelID >= 0) { - if (pATI->OptionCRT && AllowCRT) + CARD8 ClockMask, PostMask; + + if (!pATI->LCDHorizontal || !pATI->LCDVertical) + { + if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to determine dimensions of panel (ID %d).\n", + pATI->LCDPanelID); + else + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to determine dimensions of panel.\n"); + + ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + + if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel (ID %d) detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID); + else + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical); + + if (LCDPanelInfo) + { + for (i = 0; i < 24; i++) + Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i); + for (; --i >= 0; ) + if (Buffer[i] && Buffer[i] != ' ') + { + Buffer[i + 1] = '\0'; + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "Panel model %s.\n", Buffer); + break; + } + } + + /* + * Determine panel clock. This must be done after option processing so + * that the adapter's reference frequency is always available. + */ + +#ifndef AVOID_CPIO + + if (!(pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN)) + i = (inb(R_GENMO) & 0x0CU) >> 2; + else + +#endif /* AVOID_CPIO */ + + { + i = inr(CLOCK_CNTL) & 0x03U; + } + + /* + * Get post divider. A GCC bug has caused the following expression to + * be broken down into its individual components. + */ + ClockMask = PLL_VCLK0_XDIV << i; + PostMask = PLL_VCLK0_POST_DIV << (i * 2); + j = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); + j *= MaxBits(PLL_VCLK0_POST_DIV) + 1; + j |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); + + /* Calculate clock of mode on entry */ + Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + i) * + pATI->ReferenceNumerator; + Denominator = pATI->ClockDescriptor.MinM * pATI->ReferenceDenominator * + pATI->ClockDescriptor.PostDividers[j]; + pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0); + + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "Panel clock is %.3f MHz.\n", (double)(pATI->LCDClock) / 1000.0); + + if (pATI->OptionCRT) xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Using CRT interface and disabling digital flat panel.\n"); - else if (pATI->OptionCRT || AllowCRT) - { - pATI->OptionCRT = FALSE; + else xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using digital flat panel interface.\n"); - } } /* * Finish detecting video RAM size. */ + pScreenInfo->videoRam = pATI->VideoRAM; - AcceleratorVideoRAM = pScreenInfo->videoRam = pATI->VideoRAM; +#ifndef AVOID_CPIO + + AcceleratorVideoRAM = pScreenInfo->videoRam; if (pATI->Chip == ATI_CHIP_VGA) { if (pATI->depth <= 4) @@ -1341,33 +1593,43 @@ ATIPreInit { xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, "Virtual resolutions requiring more than %s kB\n of video" - " memory might not function properly." ATI_README, + " memory might not function properly.\n", (pATI->depth == 1) ? "64" : "256"); } else { xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, - "VideoRAM reduced to 256 kB due to hardware limitations." - ATI_README); + "VideoRAM reduced to 256 kB due to hardware" + " limitations.\n"); pScreenInfo->videoRam = 256; } } } else if ((pATI->NewHW.crtc == ATI_CRTC_MACH64) || (pATI->Chip >= ATI_CHIP_264CT)) + +#endif /* AVOID_CPIO */ + { + +#ifndef AVOID_CPIO + if (pATI->depth >= 8) - { - /* Set MMIO address from PCI configuration space, if available */ - if (pATI->PCIInfo && - (pATI->Block0Base = pATI->PCIInfo->memBase[2])) - pATI->Block0Base += 0x0400U; +#endif /* AVOID_CPIO */ + + { /* Possibly set up for linear aperture */ + +#ifndef AVOID_CPIO + if (pATI->OptionLinear) + +#endif /* AVOID_CPIO */ + { /* Get adapter's linear aperture configuration */ - IOValue1 = inl(pATI->CPIO_CONFIG_CNTL); + IOValue1 = inr(CONFIG_CNTL); pATI->LinearBase = GetBits(IOValue1, CFG_MEM_AP_LOC) << 22; if ((IOValue1 & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE) { @@ -1387,9 +1649,10 @@ ATIPreInit } } +#ifndef AVOID_CPIO + /* Except for PCI & AGP, allow for user override */ - if ((pATI->BusType != ATI_BUS_PCI) && - (pATI->BusType != ATI_BUS_AGP)) + if (pATI->BusType < ATI_BUS_PCI) { if (pATI->Chip == ATI_CHIP_88800CX) IOValue2 = ~((unsigned long)((1 << 23) - 1)); @@ -1433,19 +1696,33 @@ ATIPreInit } } +#endif /* AVOID_CPIO */ + if (!pATI->LinearBase || !pATI->LinearSize) { + +#ifndef AVOID_CPIO + if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + +#endif /* AVOID_CPIO */ + { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "A linear aperture is not available through this" " adapter.\n"); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } +#ifndef AVOID_CPIO + /* Insurance */ pATI->LinearBase = pATI->LinearSize = 0; + +#endif /* AVOID_CPIO */ + } else { @@ -1457,37 +1734,32 @@ ATIPreInit pATI->Block0Base = pATI->LinearBase + pATI->LinearSize - 0x00000400U; - AcceleratorVideoRAM = (pATI->LinearSize >> 10) - 2; /* 4? */ + AcceleratorVideoRAM = pATI->LinearSize >> 10; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + /* Account for MMIO area, if it cannot be disabled */ + if (pATI->Chip < ATI_CHIP_264VTB) + { + AcceleratorVideoRAM--; + if (pATI->Chip >= ATI_CHIP_264VT) + AcceleratorVideoRAM--; + } + +#else /* if X_BYTE_ORDER == X_BIG_ENDIAN */ + + /* Big-endian aperture is 8 MB higher */ + pATI->LinearBase += 0x00800000U; + +#endif /* X_BYTE_ORDER */ + if (AcceleratorVideoRAM < pATI->VideoRAM) { - if (pATI->Chip < ATI_CHIP_264VTB) - { - /* - * Don't allow virtual resolution to overlay - * register aperture(s). - */ - pScreenInfo->videoRam = AcceleratorVideoRAM; - xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, - "Virtual resolutions will be limited to %d kB" - " to account for\n accelerator register" - " aperture.\n", - AcceleratorVideoRAM); - } - else - { - /* - * On VTB's and later, ATIInit disables the primary - * register aperture. This is done so the driver - * can get at the frame buffer memory behind it. - * For MMIO purposes, the auxillary register - * aperture will be used instead. Also, ignore the - * CONFIG_CNTL register's indication of linear - * aperture size, as it is insufficient for - * adapters with more than 8MB of video memory. - */ - if (pATI->VideoRAM > (8 * 1024)) - pATI->LinearSize = 16 * 1024 * 1024; - } + pScreenInfo->videoRam = AcceleratorVideoRAM; + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Virtual resolutions will be limited to %d kB due" + " to linear aperture size.\n", + AcceleratorVideoRAM); } xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, @@ -1495,21 +1767,18 @@ ATIPreInit pATI->LinearSize >> 20, pATI->LinearBase); /* Only mmap what is needed */ - pATI->ApertureSize = pATI->LinearSize = - pATI->VideoRAM * 1024; + ApertureSize = pATI->LinearSize = pATI->VideoRAM * 1024; } } } +#ifndef AVOID_CPIO + /* Set up for a banked aperture */ if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { pATI->UseSmallApertures = TRUE; - /* Set banking port numbers */ - pATI->CPIO_MEM_VGA_RP_SEL = ATIIOPort(MEM_VGA_RP_SEL); - pATI->CPIO_MEM_VGA_WP_SEL = ATIIOPort(MEM_VGA_WP_SEL); - /* Set banking functions */ if (pATI->depth <= 4) { @@ -1540,11 +1809,10 @@ ATIPreInit pATI->Block0Base = 0x000BFC00U; } +#endif /* AVOID_CPIO */ + if (pATI->Block0Base) { - pATI->PageSize = getpagesize(); - pATI->MMIOBase = pATI->Block0Base & ~(pATI->PageSize - 1); - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using Block 0 MMIO aperture at 0x%08X.\n", pATI->Block0Base); @@ -1558,12 +1826,15 @@ ATIPreInit } } } + +#ifndef AVOID_CPIO + else /* * After BIOS initialisation, the accelerator (if any) and the VGA won't * necessarily agree on the amount of video memory, depending on whether or * where the memory boundary is configured. Any discrepancy will be - * resolved by ATIInit. + * resolved by ATIAdapterPreInit(). * * However, it's possible that there is more video memory than VGA Wonder * can architecturally handle. @@ -1584,8 +1855,8 @@ ATIPreInit else { xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, - "VideoRAM reduced to %d kB due to hardware limitations." - ATI_README, AcceleratorVideoRAM); + "VideoRAM reduced to %d kB due to hardware limitations.\n", + AcceleratorVideoRAM); pScreenInfo->videoRam = AcceleratorVideoRAM; } @@ -1620,8 +1891,24 @@ ATIPreInit } } +#endif /* AVOID_CPIO */ + + /* + * Remap apertures. Must lock and re-unlock around this in case the + * remapping fails. + */ + ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + if (!ATIMapApertures(pScreenInfo->scrnIndex, pATI)) + return FALSE; + + ATIUnlock(pATI); + if (pATI->OptionAccel) { + +#ifndef AVOID_CPIO + if (!pATI->Block0Base || (pATI->NewHW.crtc == ATI_CRTC_VGA)) { xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, @@ -1629,12 +1916,22 @@ ATIPreInit pATI->OptionAccel = FALSE; } else + +#endif /* AVOID_CPIO */ + + { xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "MMIO write caching %sabled.\n", pATI->OptionMMIOCache ? "en" : "dis"); + } } +#ifndef AVOID_CPIO + if (pATI->Adapter >= ATI_ADAPTER_MACH32) + +#endif /* AVOID_CPIO */ + { if (pATI->Chip >= ATI_CHIP_264CT) ATIReportMemory(pScreenInfo, pATI, @@ -1646,22 +1943,42 @@ ATIPreInit ATIReportMemory(pScreenInfo, pATI, ATIMemoryTypeNames_Mach[pATI->MemoryType]); } + +#ifndef AVOID_CPIO + else if (pATI->Adapter >= ATI_ADAPTER_V3) ATIReportMemory(pScreenInfo, pATI, (ATIGetExtReg(0xB7U) & 0x04U) ? "DRAM" : "VRAM"); else ATIReportMemory(pScreenInfo, pATI, "video memory"); +#endif /* AVOID_CPIO */ + /* * Finish banking setup. This needs to be fixed to not assume the mode on * entry is a VGA mode. XXX */ + +#ifndef AVOID_CPIO + if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + +#endif /* AVOID_CPIO */ + { pATI->OldHW.crtc = pATI->NewHW.crtc; + +#ifndef AVOID_CPIO + pATI->OldHW.SetBank = (ATIBankProcPtr)NoopDDA; pATI->BankInfo.BankSize = 0; /* No banking */ + +#endif /* AVOID_CPIO */ + } + +#ifndef AVOID_CPIO + else { pATI->OldHW.crtc = ATI_CRTC_VGA; @@ -1672,7 +1989,7 @@ ATIPreInit else #endif if ((pATI->Chip >= ATI_CHIP_88800GXC) && - (inl(pATI->CPIO_CRTC_GEN_CNTL) & CRTC_EXT_DISP_EN)) + (pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN)) pATI->OldHW.crtc = ATI_CRTC_MACH64; if (pATI->depth <= 4) @@ -1706,7 +2023,7 @@ ATIPreInit else if (!pATI->UseSmallApertures) pATI->OldHW.SetBank = pATI->NewHW.SetBank; else if ((pATI->OldHW.crtc == ATI_CRTC_VGA) && - !(inl(pATI->CPIO_CONFIG_CNTL) & CFG_MEM_VGA_AP_EN)) + !(pATI->LockData.config_cntl & CFG_MEM_VGA_AP_EN)) { pATI->OldHW.SetBank = (ATIBankProcPtr)NoopDDA; pATI->OldHW.nBank = 1; @@ -1716,15 +2033,19 @@ ATIPreInit else pATI->OldHW.SetBank = ATIMach64SetBankPlanar; - if (((pATI->ApertureSize * pATI->depth) / - pATI->BankInfo.nBankDepth) >= + if (((ApertureSize * pATI->depth) / pATI->BankInfo.nBankDepth) >= (unsigned)(pScreenInfo->videoRam * 1024)) pATI->BankInfo.BankSize = 0; /* No banking */ } +#endif /* AVOID_CPIO */ + if (pATI->OptionShadowFB) { /* Until ShadowFB becomes a true screen wrapper... */ + +#ifndef AVOID_CPIO + if (pATI->BankInfo.BankSize) { xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, @@ -1737,7 +2058,11 @@ ATIPreInit "Cannot shadow a planar frame buffer.\n"); pATI->OptionShadowFB = FALSE; } - else if (pATI->OptionAccel) + else + +#endif /* AVOID_CPIO */ + + if (pATI->OptionAccel) { xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Cannot shadow an accelerated frame buffer.\n"); @@ -1749,10 +2074,11 @@ ATIPreInit } /* 264VT-B's and later have DSP registers */ - if ((pATI->Chip >= ATI_CHIP_264VTB) && (pATI->CPIODecoding == BLOCK_IO) && - !ATIDSPPreInit(pScreenInfo, pATI)) + if ((pATI->Chip >= ATI_CHIP_264VTB) && + !ATIDSPPreInit(pScreenInfo->scrnIndex, pATI)) { ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -1794,12 +2120,24 @@ ATIPreInit Denominator = pATI->ClockDescriptor.MinM * pATI->XCLKReferenceDivider * pATI->ReferenceDenominator; +#ifndef AVOID_CPIO + if (pATI->depth >= 8) + +#endif /* AVOID_CPIO */ + + { Denominator *= pATI->bitsPerPixel / 4; + } + + i = (6 - 2) - pATI->XCLKPostDivider; - i = (5 - 2) - pATI->XCLKPostDivider; - if (pATI->NewHW.crtc != ATI_CRTC_VGA) - i++; +#ifndef AVOID_CPIO + + if (pATI->NewHW.crtc == ATI_CRTC_VGA) + i--; + +#endif /* AVOID_CPIO */ i = (ATIDivide(Numerator, Denominator, i, -1) / 1000) * 1000; if (i < ATIClockRange.maxClock) @@ -1869,6 +2207,9 @@ ATIPreInit break; default: + +#ifndef AVOID_CPIO + /* * 80 MHz is too high in some cases. Limit 18800-x's to 40 MHz. * Don't exceed the memory clock on VGA Wonder capables with less @@ -1883,7 +2224,13 @@ ATIPreInit ATIClockRange.maxClock = (GetBits(BIOSByte(0x44U), 0x04U) * 5000) + 40000; else + +#endif /* AVOID_CPIO */ + + { ATIClockRange.maxClock = 80000; + } + break; } if (pATI->ClockDescriptor.MaxN <= 0) @@ -1891,22 +2238,25 @@ ATIPreInit "Maximum pixel clock: %.3f MHz.\n", (double)ATIClockRange.maxClock / 1000.0); - /* Map MMIO areas */ - if (!ATIMapApertures(pScreenInfo, pATI)) - return FALSE; - /* * Determine available pixel clock frequencies. */ ATIClockPreInit(pScreenInfo, pATI, pGDev, &ATIClockRange); - if (pATI->ProgrammableClock != ATI_CLOCK_FIXED) + if (pATI->ProgrammableClock > ATI_CLOCK_FIXED) Strategy = LOOKUP_BEST_REFRESH; /* * Mode validation. */ +#ifdef AVOID_CPIO + + if (pATI->Chip >= ATI_CHIP_264CT) + minPitch = 8; + +#else /* AVOID_CPIO */ + if ((pATI->depth >= 8) && (pATI->Chip >= ATI_CHIP_264CT)) minPitch = 8; else if (pATI->CPIO_VGAWonder && @@ -1917,15 +2267,29 @@ ATIPreInit minPitch = 32; /* Very strange, but true */ maxPitch = 0x3FU; } + +#endif /* AVOID_CPIO */ + else minPitch = 16; pATI->pitchInc = minPitch; + +#ifndef AVOID_CPIO + if (pATI->depth >= 8) + +#endif /* AVOID_CPIO */ + + { pATI->pitchInc *= pATI->bitsPerPixel; + } switch (pATI->NewHW.crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: /* * IBM's VGA doesn't allow for interlaced modes. @@ -1967,6 +2331,8 @@ ATIPreInit break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: pScreenInfo->maxHValue = (MaxBits(CRTC_H_TOTAL) + 1) << 3; @@ -2077,11 +2443,11 @@ ATIPreInit &ATIClockRange, NULL, minPitch, maxPitch, pATI->pitchInc, 0, maxHeight, pScreenInfo->display->virtualX, pScreenInfo->display->virtualY, - pATI->ApertureSize, Strategy); + ApertureSize, Strategy); if (i <= 0) { - ATIUnmapApertures(pScreenInfo, pATI); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } @@ -2101,8 +2467,8 @@ ATIPreInit /* Load required modules */ if (!ATILoadModules(pScreenInfo, pATI)) { - ATIUnmapApertures(pScreenInfo, pATI); ATILock(pATI); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); return FALSE; } #endif @@ -2138,7 +2504,6 @@ ATIPreInit ATIAdapterPreInit(pScreenInfo, pATI, &pATI->NewHW); /* Relock registers */ - ATIUnmapApertures(pScreenInfo, pATI); ATILock(pATI); if (!pScreenInfo->chipset || !*pScreenInfo->chipset) @@ -2147,10 +2512,13 @@ ATIPreInit /* Generate noise if requested */ if (xf86GetVerbosity() > 3) { - ATIPrintBIOS(BIOS, 0, BIOSSize); + if (BIOSSize > 0) + ATIPrintBIOS(BIOS, 0, BIOSSize); xf86ErrorFVerb(4, "\n On server entry:\n"); ATIPrintRegisters(pATI); } + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h index d15d45a93..de23e9435 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.2 2000/02/18 12:19:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.3 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,7 @@ #define ___ATIPREINIT_H___ 1 #include "atiproto.h" + #include "xf86str.h" extern Bool ATIPreInit FunctionPrototype((ScrnInfoPtr, int)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c index d00909198..da308550a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.13 2000/06/19 15:00:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.14 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,7 @@ #include "atiadapter.h" #include "atichip.h" #include "atidac.h" +#include "atimach64io.h" #include "atiprint.h" /* @@ -82,6 +83,8 @@ ATIPrintBIOS xf86ErrorFVerb(5, " |%s|\n", Printable); } +#ifndef AVOID_CPIO + /* * ATIPrintIndexedRegisters -- * @@ -100,7 +103,7 @@ ATIPrintIndexedRegisters { int Index; - xf86ErrorFVerb(4, "\n\n %s register values:", Name); + xf86ErrorFVerb(4, "\n %s register values:", Name); for (Index = StartIndex; Index < EndIndex; Index++) { if (!(Index & (4U - 1U))) @@ -119,8 +122,12 @@ ATIPrintIndexedRegisters (void)inb(GenS1); /* Reset flip-flop */ outb(ATTRX, 0x20U); /* Turn on PAS bit */ } + + xf86ErrorFVerb(4, "\n"); } +#endif /* AVOID_CPIO */ + /* * ATIPrintMach64Registers -- * @@ -135,47 +142,102 @@ ATIPrintMach64Registers const char *Description ) { - int Index, Step, Limit; CARD32 IOValue; CARD8 dac_read, dac_mask, dac_data, dac_write; + int Index, Limit; + +#ifndef AVOID_CPIO + + int Step; + +#endif /* AVOID_CPIO */ + + xf86ErrorFVerb(4, "\n Mach64 %s register values:", Description); + +#ifdef AVOID_CPIO + + if (pATI->Chip < ATI_CHIP_264VT) + Limit = MM_IO_SELECT; + else + Limit = DWORD_SELECT; + + for (Index = 0; Index <= Limit; Index += UnitOf(MM_IO_SELECT)) + { + if (!(Index & SetBits(3, MM_IO_SELECT))) + xf86ErrorFVerb(4, "\n 0x%04X: ", Index); + if (Index == (DAC_REGS & DWORD_SELECT)) + { + dac_read = in8(DAC_REGS + 3); + DACDelay; + dac_mask = in8(DAC_REGS + 2); + DACDelay; + dac_data = in8(DAC_REGS + 1); + DACDelay; + dac_write = in8(DAC_REGS + 0); + DACDelay; + + xf86ErrorFVerb(4, " %02X%02X%02X%02X", + dac_read, dac_mask, dac_data, dac_write); + + out8(DAC_REGS + 2, dac_mask); + DACDelay; + out8(DAC_REGS + 3, dac_read); + DACDelay; + } + else + { + IOValue = inm(Index); + + if ((Index == (CRTC_GEN_CNTL & DWORD_SELECT)) && + (IOValue & CRTC_EXT_DISP_EN)) + *crtc = ATI_CRTC_MACH64; + + xf86ErrorFVerb(4, " %08X", IOValue); + } + } + +#else /* AVOID_CPIO */ - xf86ErrorFVerb(4, "\n\n Mach64 %s register values:", Description); Limit = ATIIOPort(IOPortTag(0x1FU, 0x3FU)); Step = ATIIOPort(IOPortTag(0x01U, 0x01U)) - pATI->CPIOBase; for (Index = pATI->CPIOBase; Index <= Limit; Index += Step) { if (!(((Index - pATI->CPIOBase) / Step) & 0x03U)) xf86ErrorFVerb(4, "\n 0x%04X: ", Index); - if (Index == pATI->CPIO_DAC_REGS) + if (Index == (int)ATIIOPort(DAC_REGS)) { - dac_read = inb(pATI->CPIO_DAC_REGS + 3); + dac_read = in8(DAC_REGS + 3); DACDelay; - dac_mask = inb(pATI->CPIO_DAC_REGS + 2); + dac_mask = in8(DAC_REGS + 2); DACDelay; - dac_data = inb(pATI->CPIO_DAC_REGS + 1); + dac_data = in8(DAC_REGS + 1); DACDelay; - dac_write = inb(pATI->CPIO_DAC_REGS); + dac_write = in8(DAC_REGS + 0); DACDelay; xf86ErrorFVerb(4, " %02X%02X%02X%02X", dac_read, dac_mask, dac_data, dac_write); - outb(pATI->CPIO_DAC_REGS + 2, dac_mask); + out8(DAC_REGS + 2, dac_mask); DACDelay; - outb(pATI->CPIO_DAC_REGS + 3, dac_read); + out8(DAC_REGS + 3, dac_read); DACDelay; } else { IOValue = inl(Index); - if ((Index == pATI->CPIO_CRTC_GEN_CNTL) && + if ((Index == (int)ATIIOPort(CRTC_GEN_CNTL)) && (IOValue & CRTC_EXT_DISP_EN)) *crtc = ATI_CRTC_MACH64; xf86ErrorFVerb(4, " %08X", IOValue); } } + +#endif /* AVOID_CPIO */ + + xf86ErrorFVerb(4, "\n"); } /* @@ -190,10 +252,22 @@ ATIPrintMach64PLLRegisters ATIPtr pATI ) { - int Index; - - xf86ErrorFVerb(4, "\n\n Mach64 PLL register values:"); - for (Index = 0; Index < 64; Index++) + int Index, Limit; + CARD8 PLLReg[MaxBits(PLL_ADDR) + 1]; + + for (Limit = 0; Limit < SizeOf(PLLReg); Limit++) + PLLReg[Limit] = ATIGetMach64PLLReg(Limit); + + /* Determine how many PLL registers there really are */ + while ((Limit = Limit >> 1)) + for (Index = 0; Index < Limit; Index++) + if (PLLReg[Index] != PLLReg[Index + Limit]) + goto FoundLimit; +FoundLimit: + Limit <<= 1; + + xf86ErrorFVerb(4, "\n Mach64 PLL register values:"); + for (Index = 0; Index < Limit; Index++) { if (!(Index & 3)) { @@ -201,8 +275,10 @@ ATIPrintMach64PLLRegisters xf86ErrorFVerb(4, "\n 0x%02X: ", Index); xf86ErrorFVerb(4, " "); } - xf86ErrorFVerb(4, "%02X", ATIGetMach64PLLReg(Index)); + xf86ErrorFVerb(4, "%02X", PLLReg[Index]); } + + xf86ErrorFVerb(4, "\n"); } /* @@ -220,9 +296,14 @@ ATIPrintRegisters pciConfigPtr pPCI; int Index; CARD32 lcd_index, tv_out_index, lcd_gen_ctrl; - CARD8 genmo, seq1 = 0; CARD8 dac_read, dac_mask, dac_write; - CARD8 crtc = ATI_CRTC_VGA; + CARD8 crtc; + +#ifndef AVOID_CPIO + + CARD8 genmo, seq1 = 0; + + crtc = ATI_CRTC_VGA; if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { @@ -233,39 +314,37 @@ ATIPrintRegisters { if (pATI->Chip == ATI_CHIP_264LT) { - lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + lcd_gen_ctrl = inr(LCD_GEN_CTRL); - outl(pATI->CPIO_LCD_GEN_CTRL, - lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, "Non-shadow colour CRT controller", 0); - outl(pATI->CPIO_LCD_GEN_CTRL, - lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, "Shadow colour CRT controller", 0); - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) { - lcd_index = inl(pATI->CPIO_LCD_INDEX); - lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); + lcd_index = inr(LCD_INDEX); + lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, "Non-shadow colour CRT controller", 0); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, "Shadow colour CRT controller", 0); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); - outl(pATI->CPIO_LCD_INDEX, lcd_index); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + outr(LCD_INDEX, lcd_index); } else ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, @@ -277,39 +356,37 @@ ATIPrintRegisters { if (pATI->Chip == ATI_CHIP_264LT) { - lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + lcd_gen_ctrl = inr(LCD_GEN_CTRL); - outl(pATI->CPIO_LCD_GEN_CTRL, - lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, "Non-shadow monochrome CRT controller", 0); - outl(pATI->CPIO_LCD_GEN_CTRL, - lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, "Shadow monochrome CRT controller", 0); - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); } else if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) { - lcd_index = inl(pATI->CPIO_LCD_INDEX); - lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); + lcd_index = inr(LCD_INDEX); + lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl & ~(SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, "Non-shadow monochrome CRT controller", 0); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, "Shadow monochrome CRT controller", 0); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); - outl(pATI->CPIO_LCD_INDEX, lcd_index); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + outr(LCD_INDEX, lcd_index); } else ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, @@ -329,7 +406,7 @@ ATIPrintRegisters if (pATI->ChipHasSUBSYS_CNTL) { - xf86ErrorFVerb(4, "\n\n 8514/A register values:"); + xf86ErrorFVerb(4, "\n 8514/A register values:"); for (Index = 0x02E8U; Index <= 0x0FEE8; Index += 0x0400U) { if (!((Index - 0x02E8U) & 0x0C00U)) @@ -347,20 +424,26 @@ ATIPrintRegisters xf86ErrorFVerb(4, " %04X", inw(Index)); } } + + xf86ErrorFVerb(4, "\n"); } - else if (pATI->Chip == ATI_CHIP_264LT) + else + +#endif /* AVOID_CPIO */ + + if (pATI->Chip == ATI_CHIP_264LT) { - lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL); + lcd_gen_ctrl = inr(LCD_GEN_CTRL); - outl(pATI->CPIO_LCD_GEN_CTRL, - lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, lcd_gen_ctrl & + ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "non-shadow"); - outl(pATI->CPIO_LCD_GEN_CTRL, - (lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); + outr(LCD_GEN_CTRL, (lcd_gen_ctrl & ~CRTC_RW_SELECT) | + (SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "shadow"); - outl(pATI->CPIO_LCD_GEN_CTRL, lcd_gen_ctrl); + outr(LCD_GEN_CTRL, lcd_gen_ctrl); ATIPrintMach64PLLRegisters(pATI); } @@ -368,55 +451,113 @@ ATIPrintRegisters (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) { - lcd_index = inl(pATI->CPIO_LCD_INDEX); - lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL); + lcd_index = inr(LCD_INDEX); + lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl & ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "non-shadow"); - ATIPutLTProLCDReg(LCD_GEN_CNTL, + ATIPutMach64LCDReg(LCD_GEN_CNTL, (lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "shadow"); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | CRTC_RW_SELECT); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | CRTC_RW_SELECT); ATIPrintMach64Registers(pATI, &crtc, "secondary"); - ATIPutLTProLCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); ATIPrintMach64PLLRegisters(pATI); - xf86ErrorFVerb(4, "\n\n LCD register values:"); + xf86ErrorFVerb(4, "\n LCD register values:"); for (Index = 0; Index < 64; Index++) { if (!(Index & 3)) xf86ErrorFVerb(4, "\n 0x%02X: ", Index); - xf86ErrorFVerb(4, " %08X", ATIGetLTProLCDReg(Index)); + xf86ErrorFVerb(4, " %08X", ATIGetMach64LCDReg(Index)); } - outl(pATI->CPIO_LCD_INDEX, lcd_index); + outr(LCD_INDEX, lcd_index); - tv_out_index = inl(pATI->CPIO_TV_OUT_INDEX); + tv_out_index = inr(TV_OUT_INDEX); xf86ErrorFVerb(4, "\n\n TV_OUT register values:"); for (Index = 0; Index < 256; Index++) { if (!(Index & 3)) xf86ErrorFVerb(4, "\n 0x%02X: ", Index); - xf86ErrorFVerb(4, " %08X", ATIGetLTProTVReg(Index)); + xf86ErrorFVerb(4, " %08X", ATIGetMach64TVReg(Index)); } - outl(pATI->CPIO_TV_OUT_INDEX, tv_out_index); + outr(TV_OUT_INDEX, tv_out_index); + + xf86ErrorFVerb(4, "\n"); } - else if (pATI->Chip >= ATI_CHIP_88800GXC) + else + +#ifndef AVOID_CPIO + + if (pATI->Chip >= ATI_CHIP_88800GXC) + +#endif /* AVOID_CPIO */ + { + +#ifdef AVOID_CPIO + + ATIPrintMach64Registers(pATI, &crtc, "MMIO"); + +#else /* AVOID_CPIO */ + ATIPrintMach64Registers(pATI, &crtc, (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block"); +#endif /* AVOID_CPIO */ + if (pATI->Chip >= ATI_CHIP_264CT) ATIPrintMach64PLLRegisters(pATI); } +#ifdef AVOID_CPIO + + dac_read = in8(M64_DAC_READ); + DACDelay; + dac_write = in8(M64_DAC_WRITE); + DACDelay; + dac_mask = in8(M64_DAC_MASK); + DACDelay; + + xf86ErrorFVerb(4, "\n" + " DAC read index: 0x%02X\n" + " DAC write index: 0x%02X\n" + " DAC mask: 0x%02X\n\n" + " DAC colour lookup table:", + dac_read, dac_write, dac_mask); + + out8(M64_DAC_MASK, 0xFFU); + DACDelay; + out8(M64_DAC_READ, 0x00U); + DACDelay; + + for (Index = 0; Index < 256; Index++) + { + if (!(Index & 3)) + xf86ErrorFVerb(4, "\n 0x%02X:", Index); + xf86ErrorFVerb(4, " %02X", in8(M64_DAC_DATA)); + DACDelay; + xf86ErrorFVerb(4, " %02X", in8(M64_DAC_DATA)); + DACDelay; + xf86ErrorFVerb(4, " %02X", in8(M64_DAC_DATA)); + DACDelay; + } + + out8(M64_DAC_MASK, dac_mask); + DACDelay; + out8(M64_DAC_READ, dac_read); + DACDelay; + +#else /* AVOID_CPIO */ + ATISetDACIOPorts(pATI, crtc); /* Temporarily turn off CLKDIV2 while reading DAC's LUT */ @@ -434,7 +575,7 @@ ATIPrintRegisters dac_mask = inb(pATI->CPIO_DAC_MASK); DACDelay; - xf86ErrorFVerb(4, "\n\n" + xf86ErrorFVerb(4, "\n" " DAC read index: 0x%02X\n" " DAC write index: 0x%02X\n" " DAC mask: 0x%02X\n\n" @@ -466,9 +607,11 @@ ATIPrintRegisters if ((pATI->Adapter == ATI_ADAPTER_NONISA) && (seq1 & 0x08U)) PutReg(SEQX, 0x01U, seq1); +#endif /* AVOID_CPIO */ + if ((pVideo = pATI->PCIInfo)) { - pPCI = (pciConfigPtr)(pVideo->thisCard); + pPCI = pVideo->thisCard; xf86ErrorFVerb(4, "\n\n PCI configuration register values:"); for (Index = 0; Index < 256; Index+= 4) { @@ -478,21 +621,30 @@ ATIPrintRegisters } } + xf86ErrorFVerb(4, "\n"); + +#ifndef AVOID_CPIO + if (pATI->pBank) - xf86ErrorFVerb(4, "\n\n Banked aperture at 0x%08X.\n", + xf86ErrorFVerb(4, "\n Banked aperture at 0x%08X.", pATI->pBank); else - xf86ErrorFVerb(4, "\n\n No banked aperture.\n"); + xf86ErrorFVerb(4, "\n No banked aperture."); - if (pATI->pMemory != pATI->pBank) - xf86ErrorFVerb(4, " Linear aperture at 0x%08X.\n", pATI->pMemory); + if (pATI->pMemory == pATI->pBank) + xf86ErrorFVerb(4, "\n No linear aperture.\n"); else - xf86ErrorFVerb(4, " No linear aperture.\n"); + +#endif /* AVOID_CPIO */ + + { + xf86ErrorFVerb(4, "\n Linear aperture at 0x%08X.\n", pATI->pMemory); + } if (pATI->pBlock[0]) { xf86ErrorFVerb(4, " Block 0 aperture at 0x%08X.\n", pATI->pBlock[0]); - if (inl(pATI->CPIOBase) == MMIO_IN32(pATI->pBlock[0], 0)) + if (inr(CONFIG_CHIP_ID) == pATI->config_chip_id) xf86ErrorFVerb(4, " MMIO registers are correctly mapped.\n"); else xf86ErrorFVerb(4, " MMIO mapping is in error!\n"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h index ce6c40273..cb0067377 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.5 2000/04/20 21:28:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.6 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" extern void ATIPrintBIOS FunctionPrototype((const CARD8 *, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c index b8228f2f5..527b780f7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.22 2000/06/19 15:00:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.25 2000/08/11 16:50:33 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -29,12 +29,13 @@ #include "atichip.h" #include "aticonsole.h" #include "atiident.h" -#include "atiio.h" +#include "atimach64io.h" #include "atipreinit.h" #include "atiprobe.h" #include "atiscreen.h" #include "ativalid.h" #include "ativersion.h" +#include "atividmem.h" /* * NOTES: @@ -51,6 +52,19 @@ */ /* + * An internal structure definition to facilitate the matching of detected + * adapters to XF86Config Device sections. + */ +typedef struct _ATIGDev +{ + GDevPtr pGDev; + int iATIPtr; + CARD8 Chipset; +} ATIGDev, *ATIGDevPtr; + +#ifndef AVOID_CPIO + +/* * Definitions for I/O conflict avoidance. */ #define LongPort(_Port) GetBits((_Port), PCIGETIO(SPARSE_IO_BASE)) @@ -67,17 +81,6 @@ typedef struct } PortRec, *PortPtr; /* - * An internal structure definition to facilitate the matching of detected - * adapters to XF86Config Device sections. - */ -typedef struct _ATIGDev -{ - GDevPtr pGDev; - int iATIPtr; - CARD8 Chipset; -} ATIGDev, *ATIGDevPtr; - -/* * ATIScanPCIBases -- * * This function loops though a device's PCI registered bases and accumulates @@ -139,33 +142,39 @@ ATIScanPCIBases static CARD8 ATICheckSparseIOBases ( + pciVideoPtr pVideo, CARD8 *ProbeFlags, const CARD16 IOBase, const int Count, const Bool Override ) { - CARD32 FirstPort = LongPort(IOBase), - LastPort = LongPort(IOBase + Count - 1); + CARD32 FirstPort, LastPort; - for (; FirstPort <= LastPort; FirstPort++) + if (!pVideo || !xf86IsPrimaryPci(pVideo)) { - CARD8 ProbeFlag = ProbeFlags[FirstPort]; + FirstPort = LongPort(IOBase); + LastPort = LongPort(IOBase + Count - 1); - if (ProbeFlag & DoProbe) - continue; + for (; FirstPort <= LastPort; FirstPort++) + { + CARD8 ProbeFlag = ProbeFlags[FirstPort]; - if (!(ProbeFlag & Allowed)) - return ProbeFlag; + if (ProbeFlag & DoProbe) + continue; - if (Override) - continue; + if (!(ProbeFlag & Allowed)) + return ProbeFlag; + + if (Override) + continue; - /* User might wish to override this decision */ - xf86Msg(X_WARNING, - ATI_NAME ": Sparse I/O base 0x%04X not probed." ATI_README, - IOBase); - return Allowed; + /* User might wish to override this decision */ + xf86Msg(X_WARNING, + ATI_NAME ": Sparse I/O base 0x%04X not probed.\n", + IOBase); + return Allowed; + } } return DoProbe; @@ -251,20 +260,22 @@ ATIVGAProbe static void ATIVGAWonderProbe ( - ATIPtr pATI, - ATIPtr p8514, - CARD8 *ProbeFlags + pciVideoPtr pVideo, + ATIPtr pATI, + ATIPtr p8514, + CARD8 *ProbeFlags ) { CARD8 IOValue1, IOValue2, IOValue3, IOValue4, IOValue5, IOValue6; - switch (ATICheckSparseIOBases(ProbeFlags, pATI->CPIO_VGAWonder, 2, TRUE)) + switch (ATICheckSparseIOBases(pVideo, ProbeFlags, + pATI->CPIO_VGAWonder, 2, TRUE)) { case 0: xf86Msg(X_WARNING, ATI_NAME ": Expected VGA Wonder capability could not be" " detected at I/O port 0x%04X because it would conflict with" - " a non-video PCI device." ATI_README, pATI->CPIO_VGAWonder); + " a non-video PCI device.\n", pATI->CPIO_VGAWonder); pATI->CPIO_VGAWonder = 0; break; @@ -272,7 +283,7 @@ ATIVGAWonderProbe xf86Msg(X_WARNING, ATI_NAME ": Expected VGA Wonder capability could not be" " detected at I/O port 0x%04X because it would conflict with" - " a %s %s." ATI_README, pATI->CPIO_VGAWonder, + " a %s %s.\n", pATI->CPIO_VGAWonder, ATIBusNames[p8514->BusType], ATIAdapterNames[p8514->Adapter]); pATI->CPIO_VGAWonder = 0; break; @@ -281,7 +292,7 @@ ATIVGAWonderProbe xf86Msg(X_WARNING, ATI_NAME ": Expected VGA Wonder capability could not be" " detected at I/O port 0x%04X because it would conflict with" - " a Mach64." ATI_README, pATI->CPIO_VGAWonder); + " a Mach64.\n", pATI->CPIO_VGAWonder); pATI->CPIO_VGAWonder = 0; break; @@ -313,7 +324,7 @@ ATIVGAWonderProbe xf86Msg(X_WARNING, ATI_NAME ": Expected VGA Wonder capability at I/O port 0x%04X" - " was not detected." ATI_README); + " was not detected.\n"); pATI->CPIO_VGAWonder = 0; break; } @@ -461,91 +472,216 @@ ATI8514Probe return pATI; } +#endif /* AVOID_CPIO */ + /* - * ATIMach64Probe -- + * ATIDetectMach64 -- * - * This function looks for a Mach64 at a particular I/O base address and - * returns an ATIRec if one is found. + * This function determines if a Mach64 is detectable at a particular base + * address. */ -static ATIPtr -ATIMach64Probe +static Bool +ATIDetectMach64 ( - const CARD16 IOBase, - const CARD8 IODecoding, + ATIPtr pATI, const CARD16 ChipType, const ATIChipType Chip ) { - ATIPtr pATI; CARD32 IOValue, bus_cntl, gen_test_cntl; - CARD16 IOPort; - pATI = (ATIPtr)xnfcalloc(1, SizeOf(ATIRec)); - pATI->CPIOBase = IOBase; - pATI->CPIODecoding = IODecoding; + (void)ATIMapApertures(-1, pATI); /* Ignore errors */ + +#ifdef AVOID_CPIO + + if (!pATI->pBlock[0]) + { + ATIUnmapApertures(-1, pATI); + return FALSE; + } + +#endif /* AVOID_CPIO */ /* Make sure any Mach64 is not in some weird state */ - pATI->CPIO_BUS_CNTL = ATIIOPort(BUS_CNTL); - bus_cntl = inl(pATI->CPIO_BUS_CNTL); + bus_cntl = inr(BUS_CNTL); if (Chip < ATI_CHIP_264VTB) - outl(pATI->CPIO_BUS_CNTL, + outr(BUS_CNTL, (bus_cntl & ~(BUS_HOST_ERR_INT_EN | BUS_FIFO_ERR_INT_EN)) | (BUS_HOST_ERR_INT | BUS_FIFO_ERR_INT)); else - outl(pATI->CPIO_BUS_CNTL, (bus_cntl & ~BUS_HOST_ERR_INT_EN) | - BUS_HOST_ERR_INT); + outr(BUS_CNTL, (bus_cntl & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT); - pATI->CPIO_GEN_TEST_CNTL = ATIIOPort(GEN_TEST_CNTL); - gen_test_cntl = inl(pATI->CPIO_GEN_TEST_CNTL); + gen_test_cntl = inr(GEN_TEST_CNTL); IOValue = gen_test_cntl & (GEN_OVR_OUTPUT_EN | GEN_OVR_POLARITY | GEN_CUR_EN | GEN_BLOCK_WR_EN); - outl(pATI->CPIO_GEN_TEST_CNTL, IOValue | GEN_GUI_EN); - outl(pATI->CPIO_GEN_TEST_CNTL, IOValue); - outl(pATI->CPIO_GEN_TEST_CNTL, IOValue | GEN_GUI_EN); + outr(GEN_TEST_CNTL, IOValue | GEN_GUI_EN); + outr(GEN_TEST_CNTL, IOValue); + outr(GEN_TEST_CNTL, IOValue | GEN_GUI_EN); /* See if a Mach64 answers */ - IOPort = ATIIOPort(SCRATCH_REG0); - IOValue = inl(IOPort); + IOValue = inr(SCRATCH_REG0); /* Test odd bits */ - outl(IOPort, 0x55555555U); - if (inl(IOPort) == 0x55555555U) + outr(SCRATCH_REG0, 0x55555555U); + if (inr(SCRATCH_REG0) == 0x55555555U) { /* Test even bits */ - outl(IOPort, 0xAAAAAAAAU); - if (inl(IOPort) == 0xAAAAAAAAU) + outr(SCRATCH_REG0, 0xAAAAAAAAU); + if (inr(SCRATCH_REG0) == 0xAAAAAAAAU) { /* - * *Something* has a R/W 32-bit register at this I/O address. Try - * to make sure it's a Mach64. The following assumes that ATI will + * *Something* has a R/W 32-bit register at this address. Try to + * make sure it's a Mach64. The following assumes that ATI will * not be producing any more adapters that do not register * themselves in PCI configuration space. */ ATIMach64ChipID(pATI, ChipType); - if ((pATI->Chip != ATI_CHIP_Mach64) || (IODecoding == BLOCK_IO)) + if ((pATI->Chip != ATI_CHIP_Mach64) || + (pATI->CPIODecoding == BLOCK_IO)) pATI->Adapter = ATI_ADAPTER_MACH64; } } /* Restore clobbered register value */ - outl(IOPort, IOValue); + outr(SCRATCH_REG0, IOValue); /* If no Mach64 was detected, return now */ if (pATI->Adapter != ATI_ADAPTER_MACH64) { - outl(pATI->CPIO_GEN_TEST_CNTL, gen_test_cntl); - outl(pATI->CPIO_BUS_CNTL, bus_cntl); - xfree(pATI); - return NULL; + outr(GEN_TEST_CNTL, gen_test_cntl); + outr(BUS_CNTL, bus_cntl); + ATIUnmapApertures(-1, pATI); + return FALSE; } /* Determine legacy BIOS address */ pATI->BIOSBase = 0x000C0000U + - (GetBits(inl(ATIIOPort(SCRATCH_REG1)), BIOS_BASE_SEGMENT) << 11); + (GetBits(inr(SCRATCH_REG1), BIOS_BASE_SEGMENT) << 11); + + ATIUnmapApertures(-1, pATI); + pATI->PCIInfo = NULL; + return TRUE; +} + +#ifdef AVOID_CPIO + +/* + * ATIMach64Probe -- + * + * This function looks for a Mach64 at a particular MMIO address and returns an + * ATIRec if one is found. + */ +static ATIPtr +ATIMach64Probe +( + pciVideoPtr pVideo, + const CARD16 IOBase, + const CARD8 IODecoding, + const ATIChipType Chip +) +{ + ATIPtr pATI = (ATIPtr)xnfcalloc(1, SizeOf(ATIRec)); + CARD16 ChipType = 0; + + pATI->CPIOBase = IOBase; + pATI->CPIODecoding = IODecoding; + + if (pVideo) + { + pATI->PCIInfo = pVideo; + ChipType = pVideo->chipType; + + /* + * Probe through auxiliary MMIO aperture if one exists. Because such + * apertures can be enabled/disabled only through PCI, this probes no + * further. + */ + if ((pVideo->size[2] >= 12) && (pATI->Block0Base = pVideo->memBase[2])) + { + pATI->Block0Base += 0x00000400U; + goto LastProbe; + } + + /* + * Probe through the primary MMIO aperture that exists at the tail end + * of the linear aperture. Test for both 8MB and 4MB linear apertures. + */ + if ((pVideo->size[0] >= 22) && (pATI->Block0Base = pVideo->memBase[0])) + { + pATI->Block0Base += 0x007FFC00U; + if ((pVideo->size[0] >= 23) && + ATIDetectMach64(pATI, ChipType, Chip)) + return pATI; + + pATI->Block0Base -= 0x00400000U; + if (ATIDetectMach64(pATI, ChipType, Chip)) + return pATI; + } + } + + /* + * A last, perhaps desparate, probe attempt. Note that if this succeeds, + * there's a VGA in the system and it's likely the PIO version of the + * driver should be used instead. + */ + pATI->Block0Base = 0x000BFC00; + +LastProbe: + if (ATIDetectMach64(pATI, ChipType, Chip)) + return pATI; + + xfree(pATI); + return NULL; +} + +#else /* AVOID_CPIO */ + +/* + * ATIMach64Probe -- + * + * This function looks for a Mach64 at a particular PIO address and returns an + * ATIRec if one is found. + */ +static ATIPtr +ATIMach64Probe +( + pciVideoPtr pVideo, + const CARD16 IOBase, + const CARD8 IODecoding, + const ATIChipType Chip +) +{ + ATIPtr pATI; + CARD32 IOValue; + CARD16 ChipType = 0; + + if (pVideo) + { + if ((IODecoding == BLOCK_IO) && (pVideo->size[1] < 8)) + return NULL; + + ChipType = pVideo->chipType; + } + + pATI = (ATIPtr)xnfcalloc(1, SizeOf(ATIRec)); + pATI->CPIOBase = IOBase; + pATI->CPIODecoding = IODecoding; + pATI->PCIInfo = pVideo; + + if (!ATIDetectMach64(pATI, ChipType, Chip)) + { + xfree(pATI); + return NULL; + } - /* Determine VGA capability */ - IOValue = inl(ATIIOPort(CONFIG_STATUS64_0)); - if (pATI->Chip < ATI_CHIP_264CT) + /* + * Determine VGA capability. VGA can always be enabled on integrated + * controllers. For the GX/CX, it's a board strap. + */ + IOValue = inr(CONFIG_STATUS64_0); + if (pATI->Chip >= ATI_CHIP_264CT) + pATI->VGAAdapter = ATI_ADAPTER_MACH64; + else { pATI->BusType = GetBits(IOValue, CFG_BUS_TYPE); IOValue &= (CFG_VGA_EN | CFG_CHIP_EN); @@ -558,11 +694,6 @@ ATIMach64Probe pATI->VGAOffset = 0x80U; } } - else - { - if ((pATI->Chip < ATI_CHIP_264VT) || (IOValue & CFG_VGA_EN_T)) - pATI->VGAAdapter = ATI_ADAPTER_MACH64; - } return pATI; } @@ -579,10 +710,11 @@ ATIMach64Probe static void ATIAssignVGA ( - ATIPtr *ppVGA, - ATIPtr pATI, - ATIPtr p8514, - CARD8 *ProbeFlags + pciVideoPtr pVideo, + ATIPtr *ppVGA, + ATIPtr pATI, + ATIPtr p8514, + CARD8 *ProbeFlags ) { ATIPtr pVGA = *ppVGA; @@ -605,10 +737,10 @@ ATIAssignVGA */ OldDACMask = inb(VGA_DAC_MASK); - if (inb(DAC_MASK) == OldDACMask) + if (inb(IBM_DAC_MASK) == OldDACMask) { outb(VGA_DAC_MASK, 0xA5U); - if (inb(DAC_MASK) == 0xA5U) + if (inb(IBM_DAC_MASK) == 0xA5U) pATI->VGAAdapter = ATI_ADAPTER_VGA; } @@ -627,10 +759,10 @@ ATIAssignVGA OldDACMask = inb(VGA_DAC_MASK); - if (inb(DAC_MASK) == OldDACMask) + if (inb(IBM_DAC_MASK) == OldDACMask) { outb(VGA_DAC_MASK, 0xA5U); - if (inb(DAC_MASK) == 0xA5U) + if (inb(IBM_DAC_MASK) == 0xA5U) pATI->VGAAdapter = ATI_ADAPTER_VGA; } @@ -656,10 +788,10 @@ ATIAssignVGA OldDACMask = inb(VGA_DAC_MASK); - if (inb(DAC_MASK) == OldDACMask) + if (inb(IBM_DAC_MASK) == OldDACMask) { outb(VGA_DAC_MASK, 0xA5U); - if (inb(DAC_MASK) == 0xA5U) + if (inb(IBM_DAC_MASK) == 0xA5U) pATI->VGAAdapter = ATI_ADAPTER_MACH32; } @@ -674,26 +806,24 @@ ATIAssignVGA case ATI_ADAPTER_MACH64: { - CARD16 DACMaskPort = ATIIOPort(DAC_REGS) + 2, - DACCntlPort = ATIIOPort(DAC_CNTL); - CARD32 DACCntl = inl(DACCntlPort); + CARD32 DACCntl = inr(DAC_CNTL); if (!(DACCntl & DAC_VGA_ADR_EN)) - outl(DACCntlPort, DACCntl | DAC_VGA_ADR_EN); + outr(DAC_CNTL, DACCntl | DAC_VGA_ADR_EN); OldDACMask = inb(VGA_DAC_MASK); - if (inb(DACMaskPort) == OldDACMask) + if (in8(M64_DAC_MASK) == OldDACMask) { outb(VGA_DAC_MASK, 0xA5U); - if (inb(DACMaskPort) == 0xA5U) + if (in8(M64_DAC_MASK) == 0xA5U) pATI->VGAAdapter = ATI_ADAPTER_MACH64; } outb(VGA_DAC_MASK, OldDACMask); if (!(DACCntl & DAC_VGA_ADR_EN)) - outl(DACCntlPort, DACCntl); + outr(DAC_CNTL, DACCntl); } break; @@ -709,7 +839,7 @@ ATIAssignVGA if (pATI->CPIO_VGAWonder) { - ATIVGAWonderProbe(pATI, p8514, ProbeFlags); + ATIVGAWonderProbe(pVideo, pATI, p8514, ProbeFlags); if (!pATI->CPIO_VGAWonder) { /* @@ -719,7 +849,7 @@ ATIAssignVGA * of I/O through the bus tree. */ pATI->CPIO_VGAWonder = GRAX; - ATIVGAWonderProbe(pATI, p8514, ProbeFlags); + ATIVGAWonderProbe(pVideo, pATI, p8514, ProbeFlags); } } @@ -743,14 +873,15 @@ ATIAssignVGA static void ATIClaimVGA ( - ATIPtr *ppVGA, - ATIPtr pATI, - ATIPtr p8514, - CARD8 *ProbeFlags, - int Detected + pciVideoPtr pVideo, + ATIPtr *ppVGA, + ATIPtr pATI, + ATIPtr p8514, + CARD8 *ProbeFlags, + int Detected ) { - ATIAssignVGA(ppVGA, pATI, p8514, ProbeFlags); + ATIAssignVGA(pVideo, ppVGA, pATI, p8514, ProbeFlags); if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { ATIClaimSparseIOBases(ProbeFlags, MonochromeIOBase, 48, Detected); @@ -769,24 +900,27 @@ ATIClaimVGA static void ATIFindVGA ( - ATIPtr *ppVGA, - ATIPtr *ppATI, - ATIPtr p8514, - CARD8 *ProbeFlags + pciVideoPtr pVideo, + ATIPtr *ppVGA, + ATIPtr *ppATI, + ATIPtr p8514, + CARD8 *ProbeFlags ) { ATIPtr pATI = *ppATI; if (*ppVGA) - ATIAssignVGA(ppVGA, pATI, p8514, ProbeFlags); + ATIAssignVGA(pVideo, ppVGA, pATI, p8514, ProbeFlags); else { pATI = ATIVGAProbe(pATI); if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIAssignVGA(ppATI, pATI, p8514, ProbeFlags); + ATIAssignVGA(pVideo, ppATI, pATI, p8514, ProbeFlags); } } +#endif /* AVOID_CPIO */ + /* * ATIProbe -- * @@ -800,21 +934,27 @@ ATIProbe int flags ) { - ATIPtr pATI, *ATIPtrs = NULL, pVGA = NULL, p8514 = NULL; - ATIPtr pMach64[3] = {NULL, NULL, NULL}; + ATIPtr pATI, *ATIPtrs = NULL; GDevPtr *GDevs, pGDev; pciVideoPtr pVideo, *xf86PciVideoInfo = xf86GetPciVideoInfo(); - pciConfigPtr pPCI, *xf86PciInfo = xf86GetPciConfigInfo(); + pciConfigPtr pPCI; ATIGDev *ATIGDevs = NULL, *pATIGDev; ScrnInfoPtr pScreenInfo; - PortPtr PCIPorts = NULL; CARD32 PciReg; int i, j, k; - int nGDev, nATIGDev = 0, nATIPtr = 0, nPCIPort = 0; + int nGDev, nATIGDev = 0, nATIPtr = 0; int nAdapter = 0; int Chipset; - CARD8 fChipsets[ATI_CHIPSET_MAX]; ATIChipType Chip; + +#ifndef AVOID_CPIO + + ATIPtr pVGA = NULL, p8514 = NULL; + ATIPtr pMach64[3] = {NULL, NULL, NULL}; + pciConfigPtr *xf86PciInfo = xf86GetPciConfigInfo(); + PortPtr PCIPorts = NULL; + int nPCIPort = 0; + CARD8 fChipsets[ATI_CHIPSET_MAX]; static const CARD16 Mach64SparseIOBases[] = {0x02ECU, 0x01CCU, 0x01C8U}; CARD8 ProbeFlags[LongPort(SPARSE_IO_BASE) + 1]; @@ -826,6 +966,8 @@ ATIProbe CARD8 BIOS[PrefixSize]; # define BIOSWord(_n) (*((CARD16 *)(BIOS + (_n)))) +#endif /* AVOID_CPIO */ + # define AddAdapter(_p) \ do \ { \ @@ -848,8 +990,13 @@ ATIProbe return FALSE; ATIGDevs = (ATIGDevPtr)xnfcalloc(nGDev, SizeOf(ATIGDev)); + +#ifndef AVOID_CPIO + (void)memset(fChipsets, FALSE, SizeOf(fChipsets)); +#endif /* AVOID_CPIO */ + for (i = 0, pATIGDev = ATIGDevs; i < nGDev; i++) { pGDev = GDevs[i]; @@ -876,7 +1023,13 @@ ATIProbe pATIGDev->Chipset = Chipset; nATIGDev++; pATIGDev++; + +#ifndef AVOID_CPIO + fChipsets[Chipset] = TRUE; + +#endif /* AVOID_CPIO */ + } xfree(GDevs); @@ -889,6 +1042,8 @@ ATIProbe } } +#ifndef AVOID_CPIO + /* * Collect hardware information. This must be done with care to avoid * lockups due to overlapping I/O port assignments. @@ -917,39 +1072,15 @@ ATIProbe if (xf86PciVideoInfo) for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { - pPCI = (pciConfigPtr)(pVideo->thisCard); + pPCI = pVideo->thisCard; if (pVideo->vendor == PCI_VENDOR_ATI) - { - if (pVideo->chipType == PCI_CHIP_MACH32) - continue; - - /* - * Some PCI Mach64's are not properly configured for sparse or - * block I/O. Correct PCI's USERCONFIG register, if necessary. - */ - PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); - if (IsATIBlockIOBase(pVideo->ioBase[1])) - { - /* This is block I/O */ - if (!(PciReg & 0x00000004U)) - pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, - PciReg | 0x00000004U); - } - else - { - /* This is sparse I/O */ - if (PciReg & 0x00000004U) - pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, - PciReg & ~0x00000004U); - } - continue; - } - - ATIScanPCIBases(&PCIPorts, &nPCIPort, - &pPCI->pci_base0, pVideo->size, - (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & - PCI_CMD_IO_ENABLE) ? 0 : Allowed); + ATIRefreshPCIBases(pVideo, pPCI); + else + ATIScanPCIBases(&PCIPorts, &nPCIPort, + &pPCI->pci_base0, pVideo->size, + (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & + PCI_CMD_IO_ENABLE) ? 0 : Allowed); } /* Check non-video PCI devices for I/O bases */ @@ -1006,7 +1137,7 @@ ATIProbe * failed to be detected the first time around. Each such device is probed * for again, this time with I/O temporarily enabled through PCI. */ - if (ATICheckSparseIOBases(ProbeFlags, ATTRX, 16, TRUE) == DoProbe) + if (ATICheckSparseIOBases(NULL, ProbeFlags, ATTRX, 16, TRUE) == DoProbe) { pVGA = ATIVGAProbe(NULL); if (pVGA->Adapter == ATI_ADAPTER_NONE) @@ -1025,7 +1156,7 @@ ATIProbe } } - if ((ATICheckSparseIOBases(ProbeFlags, 0x02E8U, 8, + if ((ATICheckSparseIOBases(NULL, ProbeFlags, 0x02E8U, 8, fChipsets[ATI_CHIPSET_IBM8514] || fChipsets[ATI_CHIPSET_MACH8] || fChipsets[ATI_CHIPSET_MACH32]) == DoProbe) && @@ -1035,31 +1166,66 @@ ATIProbe if ((pATI->VGAAdapter != ATI_ADAPTER_NONE) || (pATI->Coprocessor != ATI_CHIP_NONE)) - ATIClaimVGA(&pVGA, pATI, p8514, ProbeFlags, Detected8514A); + ATIClaimVGA(NULL, &pVGA, pATI, p8514, ProbeFlags, Detected8514A); ATIClaimSparseIOBases(ProbeFlags, 0x02E8U, 8, Detected8514A); } for (i = 0; i < NumberOf(Mach64SparseIOBases); i++) { - if (ATICheckSparseIOBases(ProbeFlags, Mach64SparseIOBases[i], 4, + if (ATICheckSparseIOBases(NULL, ProbeFlags, Mach64SparseIOBases[i], 4, fChipsets[ATI_CHIPSET_MACH64]) != DoProbe) continue; - if (!(pATI = ATIMach64Probe(Mach64SparseIOBases[i], SPARSE_IO, 0, 0))) + pATI = ATIMach64Probe(NULL, Mach64SparseIOBases[i], SPARSE_IO, 0); + if (!pATI) continue; AddAdapter(pMach64[i] = pATI); if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIClaimVGA(&pVGA, pATI, p8514, ProbeFlags, DetectedMach64); + ATIClaimVGA(NULL, &pVGA, pATI, p8514, ProbeFlags, DetectedMach64); ATIClaimSparseIOBases(ProbeFlags, Mach64SparseIOBases[i], 4, DetectedMach64); } +#endif /* AVOID_CPIO */ + if (xf86PciVideoInfo) { + +#ifdef AVOID_CPIO + + /* PCI Sparse I/O adapters can still be used through MMIO */ + for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) + { + if ((pVideo->vendor != PCI_VENDOR_ATI) || + (pVideo->chipType == PCI_CHIP_MACH32) || + IsATIBlockIOBase(pVideo->ioBase[1])) + continue; + + pPCI = pVideo->thisCard; + PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); + + /* Possibly fix block I/O indicator */ + if (PciReg & 0x00000004U) + pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, + PciReg & ~0x00000004U); + + Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); + + /* The CPIO base used by the adapter is of little concern here */ + pATI = ATIMach64Probe(pVideo, 0, SPARSE_IO, Chip); + if (!pATI) + continue; + + AddAdapter(pATI); + pATI->PCIInfo = pVideo; + } + +#endif /* AVOID_CPIO */ + for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { if ((pVideo->vendor != PCI_VENDOR_ATI) || @@ -1072,18 +1238,33 @@ ATIProbe if (Chip > ATI_CHIP_Mach64) continue; - pATI = ATIMach64Probe(pVideo->ioBase[1], BLOCK_IO, - pVideo->chipType, Chip); + pPCI = pVideo->thisCard; + + /* Possibly fix block I/O indicator in PCI configuration space */ + PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); + if (!(PciReg & 0x00000004U)) + pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, + PciReg | 0x00000004U); + + pATI = ATIMach64Probe(pVideo, pVideo->ioBase[1], BLOCK_IO, Chip); if (!pATI) continue; AddAdapter(pATI); +#ifndef AVOID_CPIO + /* This is probably not necessary */ if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIClaimVGA(&pVGA, pATI, p8514, ProbeFlags, DetectedMach64); + ATIClaimVGA(pVideo, &pVGA, pATI, p8514, + ProbeFlags, DetectedMach64); + +#endif /* AVOID_CPIO */ + } +#ifndef AVOID_CPIO + /* * This is the second pass through PCI configuration space. Much of * this is verbiage to deal with potential situations that are very @@ -1092,7 +1273,7 @@ ATIProbe * First, look for non-ATI shareable VGA's. For now, these must the * primary device. */ - if (ATICheckSparseIOBases(ProbeFlags, ATTRX, 16, TRUE) == DoProbe) + if (ATICheckSparseIOBases(NULL, ProbeFlags, ATTRX, 16, TRUE) == DoProbe) { for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { @@ -1105,7 +1286,7 @@ ATIProbe pVideo->func)) continue; - xf86SetPciVideo(pVideo, IO); + xf86SetPciVideo(pVideo, MEM_IO); pATI = ATIVGAProbe(NULL); if (pATI->Adapter == ATI_ADAPTER_NONE) @@ -1113,7 +1294,7 @@ ATIProbe xfree(pATI); xf86Msg(X_WARNING, ATI_NAME ": PCI/AGP VGA-compatible in slot" - " %d:%d:%d could not be detected!" ATI_README, + " %d:%d:%d could not be detected!\n", pVideo->bus, pVideo->device, pVideo->func); } else @@ -1135,13 +1316,14 @@ ATIProbe (pVideo->chipType != PCI_CHIP_MACH32)) continue; - switch (ATICheckSparseIOBases(ProbeFlags, 0x02E8U, 8, TRUE)) + switch (ATICheckSparseIOBases(pVideo, ProbeFlags, + 0x02E8U, 8, TRUE)) { case 0: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will not" " be enabled\n because it conflicts with a" - " non-video PCI device." ATI_README, + " non-video PCI device.\n", pVideo->bus, pVideo->device, pVideo->func); break; @@ -1152,7 +1334,7 @@ ATIProbe xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will" " not be enabled\n because it conflicts with" - " another %s %s." ATI_README, + " another %s %s.\n", pVideo->bus, pVideo->device, pVideo->func, ATIBusNames[p8514->BusType], ATIAdapterNames[p8514->Adapter]); @@ -1162,8 +1344,7 @@ ATIProbe xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will not" " be enabled\n because it conflicts with a" - " Mach64 at I/O base 0x02EC." - ATI_README, + " Mach64 at I/O base 0x02EC.\n", pVideo->bus, pVideo->device, pVideo->func); break; @@ -1173,20 +1354,19 @@ ATIProbe pVideo->func)) continue; - xf86SetPciVideo(pVideo, IO); + xf86SetPciVideo(pVideo, MEM_IO); if (!(pATI = ATI8514Probe(pVideo))) xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d could" - " not be detected!" ATI_README, + " not be detected!\n", pVideo->bus, pVideo->device, pVideo->func); else { if (pATI->Adapter != ATI_ADAPTER_MACH32) xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d" - " could only be detected as an %s!" - ATI_README, + " could only be detected as an %s!\n", pVideo->bus, pVideo->device, pVideo->func, ATIAdapterNames[pATI->Adapter]); @@ -1195,7 +1375,8 @@ ATIProbe if ((pATI->VGAAdapter != ATI_ADAPTER_NONE) || (pATI->Coprocessor != ATI_CHIP_NONE)) - ATIFindVGA(&pVGA, &pATI, p8514, ProbeFlags); + ATIFindVGA(pVideo, &pVGA, &pATI, p8514, + ProbeFlags); } xf86SetPciVideo(NULL, NONE); @@ -1211,31 +1392,30 @@ ATIProbe IsATIBlockIOBase(pVideo->ioBase[1])) continue; - pPCI = (pciConfigPtr)(pVideo->thisCard); + pPCI = pVideo->thisCard; PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); j = PciReg & 0x03U; if (j == 0x03U) xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d cannot be" " enabled\n because it has neither a block, nor a" - " sparse, I/O base." ATI_README, + " sparse, I/O base.\n", pVideo->bus, pVideo->device, pVideo->func); - else switch(ATICheckSparseIOBases(ProbeFlags, + else switch(ATICheckSparseIOBases(pVideo, ProbeFlags, Mach64SparseIOBases[j], 4, TRUE)) { case 0: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d will not" " be enabled\n because it conflicts with another" - " non-video PCI device." ATI_README, + " non-video PCI device.\n", pVideo->bus, pVideo->device, pVideo->func); break; case Detected8514A: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d will not" - " be enabled\n because it conflicts with an %s." - ATI_README, + " be enabled\n because it conflicts with an %s.\n", pVideo->bus, pVideo->device, pVideo->func, ATIAdapterNames[p8514->Adapter]); break; @@ -1248,8 +1428,8 @@ ATIProbe xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d will" " not be enabled\n because it conflicts with" - " another %s Mach64 at sparse I/O base 0x%04X." - ATI_README, + " another %s Mach64 at sparse I/O base" + " 0x%04X.\n", pVideo->bus, pVideo->device, pVideo->func, ATIBusNames[pATI->BusType], Mach64SparseIOBases[j]); @@ -1261,15 +1441,20 @@ ATIProbe pVideo->func)) continue; - xf86SetPciVideo(pVideo, IO); + /* Possibly fix block I/O indicator */ + if (PciReg & 0x00000004U) + pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, + PciReg & ~0x00000004U); + + xf86SetPciVideo(pVideo, MEM_IO); - pATI = ATIMach64Probe(Mach64SparseIOBases[j], SPARSE_IO, - pVideo->chipType, - ATIChipID(pVideo->chipType, pVideo->chipRev)); + Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); + pATI = ATIMach64Probe(pVideo, Mach64SparseIOBases[j], + SPARSE_IO, Chip); if (!pATI) xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d could" - " not be detected!" ATI_README, + " not be detected!\n", pVideo->bus, pVideo->device, pVideo->func); else { @@ -1278,7 +1463,8 @@ ATIProbe pATI->PCIInfo = pVideo; if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIFindVGA(&pVGA, &pATI, p8514, ProbeFlags); + ATIFindVGA(pVideo, &pVGA, &pATI, p8514, + ProbeFlags); } xf86SetPciVideo(NULL, NONE); @@ -1286,6 +1472,52 @@ ATIProbe } } +#else /* AVOID_CPIO */ + + for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) + { + if ((pVideo->vendor != PCI_VENDOR_ATI) || + (pVideo->chipType == PCI_CHIP_MACH32) || + IsATIBlockIOBase(pVideo->ioBase[1])) + continue; + + /* Check if this one has already been detected */ + for (j = 0; j < nATIPtr; j++) + { + pATI = ATIPtrs[j]; + if (pATI->PCIInfo == pVideo) + goto SkipThisSlot; + } + + if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) + continue; + + xf86SetPciVideo(pVideo, MEM_IO); + + Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); + + /* The adapter's CPIO base is of little concern here */ + pATI = ATIMach64Probe(pVideo, 0, SPARSE_IO, Chip); + if (pATI) + { + AddAdapter(pATI); + pATI->SharedAccelerator = TRUE; + pATI->PCIInfo = pVideo; + } + + xf86SetPciVideo(NULL, NONE); + + if (!pATI) + xf86Msg(X_WARNING, + ATI_NAME ": PCI Mach64 in slot %d:%d:%d could not be" + " detected!\n", + pVideo->bus, pVideo->device, pVideo->func); + + SkipThisSlot:; + } + +#endif /* AVOID_CPIO */ + /* Lastly, look for block I/O devices */ for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { @@ -1311,17 +1543,21 @@ ATIProbe continue; /* Probe for it */ - xf86SetPciVideo(pVideo, IO); + xf86SetPciVideo(pVideo, MEM_IO); - pATI = ATIMach64Probe(pVideo->ioBase[1], BLOCK_IO, - pVideo->chipType, Chip); + pATI = ATIMach64Probe(pVideo, pVideo->ioBase[1], BLOCK_IO, Chip); if (pATI) { AddAdapter(pATI); pATI->SharedAccelerator = TRUE; +#ifndef AVOID_CPIO + if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIFindVGA(&pVGA, &pATI, p8514, ProbeFlags); + ATIFindVGA(pVideo, &pVGA, &pATI, p8514, ProbeFlags); + +#endif /* AVOID_CPIO */ + } xf86SetPciVideo(NULL, NONE); @@ -1330,7 +1566,7 @@ ATIProbe { xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d could not be" - " detected!" ATI_README, + " detected!\n", pVideo->bus, pVideo->device, pVideo->func); continue; } @@ -1340,6 +1576,8 @@ ATIProbe } } +#ifndef AVOID_CPIO + /* * At this point, if there's a non-shareable VGA with its own framebuffer, * find out if it's an ATI VGA Wonder. @@ -1476,7 +1714,7 @@ ATIProbe if (!pVGA->CPIO_VGAWonder) pVGA->CPIO_VGAWonder = 0x01CEU; - ATIVGAWonderProbe(pVGA, p8514, ProbeFlags); + ATIVGAWonderProbe(NULL, pVGA, p8514, ProbeFlags); break; #if 0 case '2': @@ -1504,6 +1742,8 @@ ATIProbe NoVGAWonder:; } while (0); +#endif /* AVOID_CPIO */ + /* If no appropriate adapters have been detected, return now */ if (!nATIPtr) { @@ -1521,10 +1761,15 @@ NoVGAWonder:; { pATI = ATIPtrs[i]; +#ifndef AVOID_CPIO + if ((pATI->Adapter != ATI_ADAPTER_VGA) && ((pATI->Adapter != ATI_ADAPTER_8514A) || ((pATI->VGAAdapter != ATI_ADAPTER_VGA) && (pATI->VGAAdapter != ATI_ADAPTER_NONE)))) + +#endif /* AVOID_CPIO */ + { nAdapter++; pGDev = xf86AddDeviceToConfigure(ATI_DRIVER_NAME, @@ -1590,6 +1835,9 @@ NoVGAWonder:; switch (pATIGDev->Chipset) { case ATI_CHIPSET_ATI: + +#ifndef AVOID_CPIO + if (pATI->Adapter == ATI_ADAPTER_VGA) continue; if (pATI->Adapter != ATI_ADAPTER_8514A) @@ -1626,6 +1874,8 @@ NoVGAWonder:; break; continue; +#endif /* AVOID_CPIO */ + case ATI_CHIPSET_MACH64: if (pATI->Adapter == ATI_ADAPTER_MACH64) break; @@ -1639,7 +1889,7 @@ NoVGAWonder:; * The ChipID and ChipRev specifications are compared next. First, * require these to be unspecified for anything other than Mach32 * or Mach64 adapters. ChipRev is also required to be unspecified - * for Mach32's. ChipID is optional for for Mach32's, and both + * for Mach32's. ChipID is optional for Mach32's, and both * specifications are optional for Mach64's. Lastly, allow both * specifications to override their detected value in the case of * Mach64 adapters whose ChipID is unrecognised. @@ -1706,8 +1956,15 @@ NoVGAWonder:; */ if (pGDev->busID && pGDev->busID[0]) { - if (!(pVideo = pATI->PCIInfo)) + pVideo = pATI->PCIInfo; + +#ifndef AVOID_CPIO + + if (!pVideo) continue; + +#endif /* AVOID_CPIO */ + if (!xf86ComparePciBusString(pGDev->busID, pVideo->bus, pVideo->device, pVideo->func)) continue; @@ -1724,7 +1981,7 @@ NoVGAWonder:; xf86Msg(X_ERROR, ATI_NAME ": XF86Config Device section \"%s\" may not" - " be assigned to more than one adapter." ATI_README, + " be assigned to more than one adapter.\n", pGDev->identifier); pATIGDev->iATIPtr = -1; break; @@ -1760,9 +2017,8 @@ NoVGAWonder:; { xf86Msg(X_ERROR, ATI_NAME ": XF86Config Device sections \"%s\" and" - " \"%s\" may not be assigned to the same adapter." - ATI_README, pGDev->identifier, - ATIGDevs[k].pGDev->identifier); + " \"%s\" may not be assigned to the same adapter.\n", + pGDev->identifier, ATIGDevs[k].pGDev->identifier); pATIGDev->iATIPtr = ATIGDevs[k].iATIPtr = -1; } } @@ -1819,8 +2075,17 @@ NoVGAWonder:; if (!(pATI = ATIPtrs[i])) continue; - if ((pATI->Adapter > ATI_ADAPTER_VGA) && (pATI->iEntity < 0)) - (void)ATIClaimBusSlot(pDriver, 0, NULL, FALSE, pATI); +#ifndef AVOID_CPIO + + if (pATI->Adapter > ATI_ADAPTER_VGA) + +#endif /* AVOID_CPIO */ + + { + if (pATI->iEntity < 0) + (void)ATIClaimBusSlot(pDriver, 0, NULL, FALSE, pATI); + } + xfree(pATI); } xfree(ATIPtrs); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h index bde7d2fd7..b26bc7d83 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.4 2000/02/18 12:19:34 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.5 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,7 @@ #define ___ATIPROBE_H___ 1 #include "atiproto.h" + #include "xf86str.h" extern Bool ATIProbe FunctionPrototype((DriverPtr, int)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h index 6b8d93209..b306808eb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.10 2000/03/30 15:41:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.11 2000/08/04 21:07:15 tsi Exp $ */ /* * Copyright 1994 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -124,10 +124,10 @@ #define VBLANK 0x0002u #define HORTOG 0x0004u #define H_TOTAL 0x02e8u /* Write */ -#define DAC_MASK 0x02eau -#define DAC_R_INDEX 0x02ebu -#define DAC_W_INDEX 0x02ecu -#define DAC_DATA 0x02edu +#define IBM_DAC_MASK 0x02eau +#define IBM_DAC_READ 0x02ebu +#define IBM_DAC_WRITE 0x02ecu +#define IBM_DAC_DATA 0x02edu #define H_DISP 0x06e8u /* Write */ #define H_SYNC_STRT 0x0ae8u /* Write */ #define H_SYNC_WID 0x0ee8u /* Write */ @@ -273,7 +273,7 @@ #define SCISSORS_L 0x2000u #define SCISSORS_B 0x3000u #define SCISSORS_R 0x4000u -#define MEM_CNTL 0x5000u +#define M32_MEM_CNTL 0x5000u #define HORCFG_4 0x0000u #define HORCFG_5 0x0001u #define HORCFG_8 0x0002u @@ -949,7 +949,7 @@ #define HFB_PITCH_ADDR BlockIOTag(0x2au) /* LT */ #define LCD_DATA BlockIOTag(0x2au) /* LTPro */ #define EXT_MEM_CNTL BlockIOTag(0x2bu) /* VTB/GTB/LT */ -#define MEM_INFO IOPortTag(0x14u, 0x2cu) /* Renamed MEM_CNTL */ +#define MEM_CNTL IOPortTag(0x14u, 0x2cu) #define CTL_MEM_SIZE 0x00000007ul /* ? 0x00000008ul */ #define CTL_MEM_REFRESH 0x00000078ul /* VT/GT */ @@ -993,7 +993,7 @@ #define CTL_MEM_PIX_WIDTH 0x07000000ul #define CTL_MEM_LOWER_APER_ENDIAN 0x03000000ul /* VTB/GTB/LT */ #define CTL_MEM_OE_SELECT 0x18000000ul /* VT/GT */ -#define CTL_MEM_UPPER_APER_ENDIAN 0c0c000000ul /* VTB/GTB/LT */ +#define CTL_MEM_UPPER_APER_ENDIAN 0x0c000000ul /* VTB/GTB/LT */ /* ? 0xe0000000ul */ #define CTL_MEM_PAGE_SIZE 0x30000000ul /* VTB/GTB/LT */ #define MEM_VGA_WP_SEL IOPortTag(0x15u, 0x2du) @@ -1005,6 +1005,10 @@ #define LT_GIO BlockIOTag(0x2fu) /* LT */ #define I2C_CNTL_1 BlockIOTag(0x2fu) /* GTPro */ #define DAC_REGS IOPortTag(0x17u, 0x30u) /* 4 separate bytes */ +#define M64_DAC_WRITE (DAC_REGS + 0) +#define M64_DAC_DATA (DAC_REGS + 1) +#define M64_DAC_MASK (DAC_REGS + 2) +#define M64_DAC_READ (DAC_REGS + 3) #define DAC_CNTL IOPortTag(0x18u, 0x31u) #define DAC_EXT_SEL 0x00000003ul #define DAC_EXT_SEL_RS2 0x000000001ul @@ -1861,6 +1865,12 @@ /* ? BlockIOTag(0x1feu) */ /* ? BlockIOTag(0x1ffu) */ +/* Definitions for MEM_CNTL's CTL_MEM_?????_APER_ENDIAN fields */ +#define CTL_MEM_APER_BYTE_ENDIAN 0x00u +#define CTL_MEM_APER_WORD_ENDIAN 0x01u +#define CTL_MEM_APER_LONG_ENDIAN 0x02u +/* ? 0x03u */ + /* Definitions for an ICS2595's programme word */ #define ICS2595_CLOCK 0x000001f0ul #define ICS2595_FB_DIV 0x0001fe00ul /* Feedback divider */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c index 85d650d89..706ee1b25 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.9 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.11 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -136,6 +136,9 @@ ATIScreenInit /* Initialise framebuffer layer */ switch (pATI->bitsPerPixel) { + +#ifndef AVOID_CPIO + case 1: pATI->Closeable = xf1bppScreenInit(pScreen, pFB, pScreenInfo->virtualX, pScreenInfo->virtualY, @@ -148,6 +151,8 @@ ATIScreenInit pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth); break; +#endif /* AVOID_CPIO */ + case 8: pATI->Closeable = cfbScreenInit(pScreen, pFB, pScreenInfo->virtualX, pScreenInfo->virtualY, @@ -201,12 +206,16 @@ ATIScreenInit xf86SetBlackWhitePixels(pScreen); +#ifndef AVOID_CPIO + /* Initialise banking if needed */ if (!miInitializeBanking(pScreen, pScreenInfo->virtualX, pScreenInfo->virtualY, pATI->displayWidth, &pATI->BankInfo)) return FALSE; +#endif /* AVOID_CPIO */ + /* Initialise DGA support */ (void)ATIDGAInit(pScreenInfo, pScreen, pATI); @@ -225,6 +234,16 @@ ATIScreenInit if (!miCreateDefColormap(pScreen)) return FALSE; +#ifdef AVOID_CPIO + + if (!xf86HandleColormaps(pScreen, 256, pScreenInfo->rgbBits, + ATILoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | + CMAP_LOAD_EVEN_IF_OFFSCREEN)) + return FALSE; + +#else /* AVOID_CPIO */ + if (pATI->depth > 1) if (!xf86HandleColormaps(pScreen, (pATI->depth == 4) ? 16 : 256, pScreenInfo->rgbBits, ATILoadPalette, NULL, @@ -232,6 +251,8 @@ ATIScreenInit CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE; +#endif /* AVOID_CPIO */ + /* Initialise shadow framebuffer */ if (pATI->OptionShadowFB && !ShadowFBInit(pScreen, ATIRefreshArea)) @@ -283,6 +304,10 @@ ATICloseScreen ATILeaveGraphics(pScreenInfo, pATI); + xfree(pATI->ExpansionBitmapScanlinePtr[1]); + pATI->ExpansionBitmapScanlinePtr[0] = + pATI->ExpansionBitmapScanlinePtr[1] = NULL; + xfree(pATI->pShadow); pATI->pShadow = NULL; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h index f2c1883d8..ba662df3a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.2 2000/02/18 12:19:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.3 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,7 @@ #define ___ATISCREEN_H___ 1 #include "atiproto.h" + #include "screenint.h" extern Bool ATIScreenInit FunctionPrototype((int, ScreenPtr, int, char **)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h index c75b44baf..7bce0c90a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.18 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.20 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -27,6 +27,7 @@ #include "atibank.h" #include "aticlock.h" #include "atiregs.h" + #include "xf86Resources.h" #include "xaa.h" @@ -51,16 +52,26 @@ typedef struct _ATIHWRec /* The CRTC used to drive the screen (VGA, 8514, Mach64) */ CARD8 crtc; - /* VGA registers */ - CARD8 genmo, crt[25], seq[5], gra[9], attr[21], lut[256 * 3]; + /* Colour lookup table */ + CARD8 lut[256 * 3]; - /* Generic DAC registers */ - CARD8 dac_read, dac_write, dac_mask; +#ifndef AVOID_CPIO + + /* VGA registers */ + CARD8 genmo, crt[25], seq[5], gra[9], attr[21]; /* VGA Wonder registers */ CARD8 a3, a6, a7, ab, ac, ad, ae, b0, b1, b2, b3, b5, b6, b8, b9, ba, bd, be, bf; + /* Shadow VGA CRTC registers */ + CARD8 shadow_vga[25]; + +#endif /* AVOID_CPIO */ + + /* Generic DAC registers */ + CARD8 dac_read, dac_write, dac_mask; + /* Mach64 PLL registers */ CARD8 pll_vclk_cntl, pll_vclk_post_div, pll_vclk0_fb_div, pll_vclk1_fb_div, @@ -79,9 +90,6 @@ typedef struct _ATIHWRec CARD32 lcd_index, config_panel, lcd_gen_ctrl, horz_stretching, vert_stretching, ext_vert_stretch; - /* Shadow VGA CRTC registers */ - CARD8 shadow_vga[25]; - /* Shadow Mach64 CRTC registers */ CARD32 shadow_h_total_disp, shadow_h_sync_strt_wid, shadow_v_total_disp, shadow_v_sync_strt_wid; @@ -111,10 +119,15 @@ typedef struct _ATIHWRec /* Clock programming data */ int FeedbackDivider, ReferenceDivider, PostDivider; +#ifndef AVOID_CPIO + /* This is used by ATISwap() */ pointer frame_buffer; ATIBankProcPtr SetBank; unsigned int nBank, nPlane; + +#endif /* AVOID_CPIO */ + } ATIHWRec; /* @@ -130,15 +143,27 @@ typedef struct _ATIRec /* * Adapter-related definitions. */ - CARD8 Adapter, VGAAdapter; + CARD8 Adapter; + +#ifndef AVOID_CPIO + + CARD8 VGAAdapter; + +#endif /* AVOID_CPIO */ /* * Chip-related definitions. */ - CARD8 Chip, Coprocessor; + CARD32 config_chip_id; CARD16 ChipType; + CARD8 Chip; CARD8 ChipClass, ChipRevision, ChipRev, ChipVersion, ChipFoundry; - CARD8 ChipHasSUBSYS_CNTL; + +#ifndef AVOID_CPIO + + CARD8 Coprocessor, ChipHasSUBSYS_CNTL; + +#endif /* AVOID_CPIO */ /* * Processor I/O decoding definitions. @@ -146,6 +171,8 @@ typedef struct _ATIRec CARD8 CPIODecoding; CARD16 CPIOBase; +#ifndef AVOID_CPIO + /* * Processor I/O port definition for VGA. */ @@ -158,36 +185,34 @@ typedef struct _ATIRec CARD8 B2Reg; /* The B2 mirror */ CARD8 VGAOffset; /* Low index for CPIO_VGAWonder */ - /* - * Processor I/O port definitions for Mach64. - */ - CARD16 CPIO_CRTC_H_TOTAL_DISP, CPIO_CRTC_H_SYNC_STRT_WID, - CPIO_CRTC_V_TOTAL_DISP, CPIO_CRTC_V_SYNC_STRT_WID, - CPIO_CRTC_OFF_PITCH, CPIO_CRTC_INT_CNTL, CPIO_CRTC_GEN_CNTL, - CPIO_DSP_CONFIG, CPIO_DSP_ON_OFF, CPIO_OVR_CLR, - CPIO_OVR_WID_LEFT_RIGHT, CPIO_OVR_WID_TOP_BOTTOM, - CPIO_TV_OUT_INDEX, CPIO_CLOCK_CNTL, CPIO_TV_OUT_DATA, - CPIO_BUS_CNTL, CPIO_LCD_INDEX, CPIO_LCD_DATA, CPIO_MEM_INFO, - CPIO_MEM_VGA_WP_SEL, CPIO_MEM_VGA_RP_SEL, - CPIO_DAC_REGS, CPIO_DAC_CNTL, - CPIO_HORZ_STRETCHING, CPIO_VERT_STRETCHING, - CPIO_GEN_TEST_CNTL, CPIO_LCD_GEN_CTRL, - CPIO_POWER_MANAGEMENT, CPIO_CONFIG_CNTL; +#endif /* AVOID_CPIO */ /* * DAC-related definitions. */ - CARD16 DAC; + +#ifndef AVOID_CPIO + CARD16 CPIO_DAC_MASK, CPIO_DAC_DATA, CPIO_DAC_READ, CPIO_DAC_WRITE; + +#endif /* AVOID_CPIO */ + + CARD16 DAC; CARD8 rgbBits; /* * Definitions related to system bus interface. */ pciVideoPtr PCIInfo; - resRange VGAWonderResources[2]; CARD8 BusType; - CARD8 SharedVGA, SharedAccelerator; + CARD8 SharedAccelerator; + +#ifndef AVOID_CPIO + + CARD8 SharedVGA; + resRange VGAWonderResources[2]; + +#endif /* AVOID_CPIO */ /* * Definitions related to video memory. @@ -203,32 +228,42 @@ typedef struct _ATIRec /* * Definitions related to video memory apertures. */ - pointer pBank, pMemory, pShadow; - unsigned long LinearBase, ApertureBase; - int LinearSize, ApertureSize, FBPitch, FBBytesPerPixel; + pointer pMemory, pShadow; + unsigned long LinearBase; + int LinearSize, FBPitch, FBBytesPerPixel; + +#ifndef AVOID_CPIO + + pointer pBank; CARD8 UseSmallApertures; +#endif /* AVOID_CPIO */ + /* * Definitions related to MMIO register apertures. */ pointer pMMIO, pBlock[2]; - unsigned long PageSize, MMIOBase; unsigned long Block0Base, Block1Base; +#ifndef AVOID_CPIO + /* * Banking interface. */ miBankInfoRec BankInfo; +#endif /* AVOID_CPIO */ + /* * XAA interface. */ XAAInfoRecPtr pXAAInfo; - int nAvailableFIFOEntries, nFIFOEntries; + int nAvailableFIFOEntries, nFIFOEntries, nHostFIFOEntries; CARD8 EngineIsBusy, EngineIsLocked, XModifier; CARD32 dst_cntl; /* For SetupFor/Subsequent communication */ - CARD32 ExpansionBitmapScanline[256]; - CARD32 *ExpansionBitmapScanlinePtr; + CARD16 sc_left, sc_right, sc_top, sc_bottom; /* Current scissors */ + pointer pHOST_DATA; /* Current HOST_DATA_* transfer window address */ + CARD32 *ExpansionBitmapScanlinePtr[2]; int ExpansionBitmapWidth; /* @@ -241,9 +276,10 @@ typedef struct _ATIRec * Clock-related definitions. */ int ClockNumberToProgramme, ReferenceNumerator, ReferenceDenominator; + int ProgrammableClock; ClockRec ClockDescriptor; CARD16 BIOSClocks[16]; - CARD8 Clock, ProgrammableClock; + CARD8 Clock; /* * DSP register data. @@ -286,21 +322,28 @@ typedef struct _ATIRec */ struct { + /* Mach64 registers */ + CARD32 bus_cntl, crtc_gen_cntl, mem_cntl, gen_test_cntl, crtc_int_cntl, + lcd_index; + +#ifndef AVOID_CPIO + + CARD32 config_cntl, dac_cntl; + + /* Mach8/Mach32 registers */ + CARD16 clock_sel, misc_options, mem_bndry, mem_cfg; + + /* VGA Wonder registers */ + CARD8 a6, ab, b1, b4, b5, b6, b8, b9, be; + /* VGA registers */ CARD8 crt03, crt11; /* VGA shadow registers */ CARD8 shadow_crt03, shadow_crt11; - /* VGA Wonder registers */ - CARD8 a6, ab, b1, b4, b5, b6, b8, b9, be; +#endif /* AVOID_CPIO */ - /* Mach8/Mach32 registers */ - CARD16 clock_sel, misc_options, mem_bndry, mem_cfg; - - /* Mach64 registers */ - CARD32 bus_cntl, config_cntl, crtc_gen_cntl, mem_info, gen_test_cntl, - dac_cntl, crtc_int_cntl, lcd_index; } LockData; /* Mode data */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c index 44109758c..c6f49f260 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.10 2000/04/12 14:44:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.11 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,6 +26,7 @@ #include "aticrtc.h" #include "atistruct.h" #include "ativalid.h" + #include "xf86.h" /* @@ -45,8 +46,13 @@ ATIValidMode ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; ATIPtr pATI = ATIPTR(pScreenInfo); Bool InterlacedSeen; - int VDisplay, VTotal, HBlankWidth; - int HAdjust, VScan, VInterlace; + int HBlankWidth, HAdjust, VScan, VInterlace; + +#ifndef AVOID_CPIO + + int VDisplay, VTotal; + +#endif /* AVOID_CPIO */ if (flags & MODECHECK_FINAL) { @@ -170,7 +176,7 @@ ATIValidMode pMode->VTotal = ATIReverseVertical(CrtcVTotal); # undef ATIReverseHorizontal -# undef ATIReverVertical +# undef ATIReverseVertical } HBlankWidth = (pMode->HTotal >> 3) - (pMode->HDisplay >> 3); @@ -179,6 +185,9 @@ ATIValidMode switch (pATI->NewHW.crtc) { + +#ifndef AVOID_CPIO + case ATI_CRTC_VGA: /* Prevent overscans */ if (HBlankWidth > 63) @@ -210,6 +219,8 @@ ATIValidMode break; +#endif /* AVOID_CPIO */ + case ATI_CRTC_MACH64: if (VScan > 2) return MODE_NO_VSCAN; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h index 09881d94e..51daa8ee8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.4 2000/02/18 12:19:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.5 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -25,6 +25,7 @@ #define ___ATIVALID_H___ 1 #include "atiproto.h" + #include "xf86str.h" extern int ATIValidMode FunctionPrototype((int, DisplayModePtr, Bool, int)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h index d96b5fbd2..cd3bdefb1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.16 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.18 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -27,11 +27,11 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "5.3.5" +#define ATI_VERSION_NAME "6.0.0" -#define ATI_VERSION_MAJOR 5 -#define ATI_VERSION_MINOR 3 -#define ATI_VERSION_PATCH 5 +#define ATI_VERSION_MAJOR 6 +#define ATI_VERSION_MINOR 0 +#define ATI_VERSION_PATCH 0 #define ATI_VERSION_CURRENT \ ((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c index ab5c10032..5d1d26a9a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.11 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.12 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -27,11 +27,16 @@ #include "atiio.h" #include "atimono.h" #include "ativga.h" + #include "xf86.h" -#define DPMS_SERVER +#ifndef DPMS_SERVER +# define DPMS_SERVER +#endif #include "extensions/dpms.h" +#ifndef AVOID_CPIO + /* * ATIVGAPreInit -- * @@ -496,3 +501,5 @@ ATIVGASetDPMSMode PutReg(CRTX(pATI->CPIO_VGABase), 0x17U, crt17); PutReg(SEQX, 0x01U, 0x03U); /* End synchonous reset */ } + +#endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h index bda485384..8661c8c05 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.6 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.7 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,8 +26,11 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" +#ifndef AVOID_CPIO + extern void ATIVGAPreInit FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIVGASave FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIVGACalculate FunctionPrototype((ATIPtr, ATIHWPtr, @@ -37,4 +40,6 @@ extern void ATIVGASet FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIVGASaveScreen FunctionPrototype((ATIPtr, int)); extern void ATIVGASetDPMSMode FunctionPrototype((ATIPtr, int)); +#endif /* AVOID_CPIO */ + #endif /* ___ATIVGA_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c index 45e6a1bd9..ac25c450b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.8 2000/02/18 12:19:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.9 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -65,6 +65,8 @@ const char *ATIMemoryTypeNames_264xT[] = "Unknown video memory type" }; +#ifndef AVOID_CPIO + /* * ATIUnmapVGA -- * @@ -73,18 +75,20 @@ const char *ATIMemoryTypeNames_264xT[] = static void ATIUnmapVGA ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { if (!pATI->pBank) return; - xf86UnMapVidMem(pScreenInfo->scrnIndex, pATI->pBank, 0x00010000U); + xf86UnMapVidMem(iScreen, pATI->pBank, 0x00010000U); pATI->pBank = pATI->BankInfo.pBankA = pATI->BankInfo.pBankB = NULL; } +#endif /* AVOID_CPIO */ + /* * ATIUnmapLinear -- * @@ -93,13 +97,33 @@ ATIUnmapVGA static void ATIUnmapLinear ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { + unsigned long PageSize; + int LinearSize; + +#ifdef AVOID_CPIO + + if (!pATI->pMemory) + return; + +#else /* AVOID_CPIO */ + if (pATI->pMemory != pATI->pBank) - xf86UnMapVidMem(pScreenInfo->scrnIndex, pATI->pMemory, - pATI->LinearSize); + +#endif /* AVOID_CPIO */ + + { + PageSize = getpagesize(); + LinearSize = pATI->LinearSize; + if (((pATI->Block0Base | (PageSize - 1)) + 1) == + (pATI->LinearBase + LinearSize)) + LinearSize -= PageSize; + + xf86UnMapVidMem(iScreen, pATI->pMemory, LinearSize); + } pATI->pMemory = NULL; } @@ -112,12 +136,12 @@ ATIUnmapLinear static void ATIUnmapMMIO ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { if (pATI->pMMIO) - xf86UnMapVidMem(pScreenInfo->scrnIndex, pATI->pMMIO, pATI->PageSize); + xf86UnMapVidMem(iScreen, pATI->pMMIO, getpagesize()); pATI->pMMIO = pATI->pBlock[0] = pATI->pBlock[1] = NULL; } @@ -130,15 +154,42 @@ ATIUnmapMMIO Bool ATIMapApertures ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { - pciVideoPtr pVideo; + pciVideoPtr pVideo; + PCITAG Tag; + unsigned long PageSize, MMIOBase; + int LinearSize; if (pATI->Mapped) return TRUE; +#ifndef AVOID_CPIO + + if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + +#endif /* AVOID_CPIO */ + + { + if (!pATI->LinearBase && !pATI->Block0Base) + return FALSE; + } + + PageSize = getpagesize(); + MMIOBase = pATI->Block0Base & ~(PageSize - 1); + LinearSize = pATI->LinearSize; + if ((MMIOBase + PageSize) == (pATI->LinearBase + LinearSize)) + LinearSize -= PageSize; + + if ((pVideo = pATI->PCIInfo)) + Tag = ((pciConfigPtr)(pVideo->thisCard))->tag; + else + Tag = 0; + +#ifndef AVOID_CPIO + /* Map VGA aperture */ if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { @@ -146,8 +197,12 @@ ATIMapApertures * No relocation, resizing, caching or write-combining of this * aperture is supported. Hence, the hard-coded values here... */ - pATI->pBank = xf86MapVidMem(pScreenInfo->scrnIndex, VIDMEM_MMIO, - 0x000A0000U, 0x00010000U); + if (pVideo) + pATI->pBank = xf86MapPciMem(iScreen, VIDMEM_MMIO, + Tag, 0x000A0000U, 0x00010000U); + else + pATI->pBank = xf86MapVidMem(iScreen, VIDMEM_MMIO, + 0x000A0000U, 0x00010000U); if (!pATI->pBank) return FALSE; @@ -155,66 +210,71 @@ ATIMapApertures pATI->pMemory = pATI->BankInfo.pBankA = pATI->BankInfo.pBankB = pATI->pBank; + + pATI->Mapped = TRUE; } - pVideo = pATI->PCIInfo; +#endif /* AVOID_CPIO */ /* Map linear aperture */ if (pATI->LinearBase) { if (pVideo) - pATI->pMemory = xf86MapPciMem(pScreenInfo->scrnIndex, - VIDMEM_FRAMEBUFFER, ((pciConfigPtr)(pVideo->thisCard))->tag, - pATI->LinearBase, pATI->LinearSize); + pATI->pMemory = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER, + Tag, pATI->LinearBase, LinearSize); else - pATI->pMemory = xf86MapVidMem(pScreenInfo->scrnIndex, - VIDMEM_FRAMEBUFFER, pATI->LinearBase, pATI->LinearSize); + pATI->pMemory = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER, + pATI->LinearBase, LinearSize); if (!pATI->pMemory) { - ATIUnmapVGA(pScreenInfo, pATI); + +#ifndef AVOID_CPIO + + ATIUnmapVGA(iScreen, pATI); + +#endif /* AVOID_CPIO */ + + pATI->Mapped = FALSE; return FALSE; } + + pATI->Mapped = TRUE; } /* Map MMIO aperture */ if (pATI->Block0Base) { - if ((pATI->Block0Base >= pATI->LinearBase) && - ((pATI->Block0Base + 0x00000400U) <= - (pATI->LinearBase + pATI->LinearSize))) - { - pATI->pBlock[0] = (char *)pATI->pMemory + - (pATI->Block0Base - pATI->LinearBase); - } + if (pVideo) + pATI->pMMIO = xf86MapPciMem(iScreen, VIDMEM_MMIO, + Tag, MMIOBase, PageSize); else + pATI->pMMIO = xf86MapVidMem(iScreen, VIDMEM_MMIO, + MMIOBase, PageSize); + + if (!pATI->pMMIO) { - if (pVideo && - ((pATI->Block0Base < 0x000A0000U) || - (pATI->Block0Base > (0x000B0000U - 0x00000400U)))) - pATI->pMMIO = xf86MapPciMem(pScreenInfo->scrnIndex, - VIDMEM_MMIO, ((pciConfigPtr)(pVideo->thisCard))->tag, - pATI->MMIOBase, pATI->PageSize); - else - pATI->pMMIO = xf86MapVidMem(pScreenInfo->scrnIndex, - VIDMEM_MMIO, pATI->MMIOBase, pATI->PageSize); - - if (!pATI->pMMIO) - { - ATIUnmapLinear(pScreenInfo, pATI); - ATIUnmapVGA(pScreenInfo, pATI); - return FALSE; - } - - pATI->pBlock[0] = (char *)pATI->pMMIO + - (pATI->Block0Base - pATI->MMIOBase); + ATIUnmapLinear(iScreen, pATI); + +#ifndef AVOID_CPIO + + ATIUnmapVGA(iScreen, pATI); + +#endif /* AVOID_CPIO */ + + pATI->Mapped = FALSE; + return FALSE; } + pATI->Mapped = TRUE; + + pATI->pBlock[0] = (char *)pATI->pMMIO + + (pATI->Block0Base - MMIOBase); + if (pATI->Block1Base) pATI->pBlock[1] = (char *)pATI->pBlock[0] - 0x00000400U; } - pATI->Mapped = TRUE; return TRUE; } @@ -226,8 +286,8 @@ ATIMapApertures void ATIUnmapApertures ( - ScrnInfoPtr pScreenInfo, - ATIPtr pATI + int iScreen, + ATIPtr pATI ) { if (!pATI->Mapped) @@ -235,11 +295,16 @@ ATIUnmapApertures pATI->Mapped = FALSE; /* Unmap MMIO area */ - ATIUnmapMMIO(pScreenInfo, pATI); + ATIUnmapMMIO(iScreen, pATI); /* Unmap linear aperture */ - ATIUnmapLinear(pScreenInfo, pATI); + ATIUnmapLinear(iScreen, pATI); + +#ifndef AVOID_CPIO /* Unmap VGA aperture */ - ATIUnmapVGA(pScreenInfo, pATI); + ATIUnmapVGA(iScreen, pATI); + +#endif /* AVOID_CPIO */ + } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h index 3aa90311b..51ef6f299 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.5 2000/02/18 12:19:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.6 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,7 +26,6 @@ #include "atiproto.h" #include "atipriv.h" -#include "xf86str.h" /* Memory types for 68800's and 88800GX's */ typedef enum @@ -70,7 +69,7 @@ typedef enum } ATI264MemoryType; extern const char *ATIMemoryTypeNames_264xT[]; -extern Bool ATIMapApertures FunctionPrototype((ScrnInfoPtr, ATIPtr)); -extern void ATIUnmapApertures FunctionPrototype((ScrnInfoPtr, ATIPtr)); +extern Bool ATIMapApertures FunctionPrototype((int, ATIPtr)); +extern void ATIUnmapApertures FunctionPrototype((int, ATIPtr)); #endif /* ___ATIVIDMEM_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c index ad55dc846..c6aeecb3a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.8 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.10 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -50,10 +50,13 @@ * accessed at indices 0xB0 through 0xBF on all chipsets. */ +#include "ati.h" #include "atichip.h" #include "atiio.h" #include "atiwonder.h" +#ifndef AVOID_CPIO + /* * ATIVGAWonderPreInit -- * @@ -296,3 +299,5 @@ ATIVGAWonderSet ATIModifyExtReg(pATI, 0xBAU, -1, 0x00U, pATIHW->ba); ATIModifyExtReg(pATI, 0xBDU, -1, 0x00U, pATIHW->bd); } + +#endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h index dcf390c04..04299eb36 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.5 2000/06/19 15:00:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.6 2000/08/04 21:07:16 tsi Exp $ */ /* * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * @@ -26,12 +26,17 @@ #include "atipriv.h" #include "atiproto.h" + #include "xf86str.h" +#ifndef AVOID_CPIO + extern void ATIVGAWonderPreInit FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIVGAWonderSave FunctionPrototype((ATIPtr, ATIHWPtr)); extern void ATIVGAWonderCalculate FunctionPrototype((ATIPtr, ATIHWPtr, DisplayModePtr)); extern void ATIVGAWonderSet FunctionPrototype((ATIPtr, ATIHWPtr)); +#endif /* AVOID_CPIO */ + #endif /* ___ATIWONDER_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c index 03af630e3..d0638255e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.91 2000/06/21 17:28:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.92 2000/08/04 16:13:28 eich Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> @@ -3382,10 +3382,13 @@ CHIPSEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); - ErrorF("CHIPSEnterVT"); + /* Should we re-save the text mode on each VT enter? */ if(!chipsModeInit(pScrn, pScrn->currentMode)) return FALSE; + if ((!(cPtr->Flags & ChipsOverlay8plus16)) && + (cPtr->Flags & ChipsVideoSupport)) + CHIPSResetVideo(pScrn); chipsHWCursorOn(cPtr); /* cursor settle delay */ usleep(50000); @@ -3418,7 +3421,7 @@ chipsLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); int i, index, shift ; - + shift = ((pScrn->depth == 15) && (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0; @@ -3954,11 +3957,11 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetSilkenMouse(pScreen); #endif - if ((!(cPtr->Flags & ChipsOverlay8plus16)) && - (cPtr->Flags & ChipsVideoSupport)) { - CHIPSInitVideo(pScreen); + if ((!(cPtr->Flags & ChipsOverlay8plus16)) && + (cPtr->Flags & ChipsVideoSupport)) { + CHIPSInitVideo(pScreen); } - + pScreen->SaveScreen = CHIPSSaveScreen; #ifdef DPMSExtension 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 ed608e545..b47e55e44 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.2 2000/04/07 03:57:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.3 2000/08/04 16:13:30 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -302,9 +302,6 @@ CHIPSSetupImageVideo(ScreenPtr pScreen) cPtr->adaptor = adapt; - cPtr->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = CHIPSBlockHandler; - xvColorKey = MAKE_ATOM("XV_COLORKEY"); CHIPSResetVideo(pScrn); @@ -425,7 +422,6 @@ CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) unsigned char mr3c; REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - CHIPSHiQVSync(pScrn); if(exit) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { @@ -437,10 +433,13 @@ CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) pPriv->area = NULL; } pPriv->videoStatus = 0; + pScrn->pScreen->BlockHandler = cPtr->BlockHandler; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { pPriv->videoStatus |= OFF_TIMER; pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + cPtr->BlockHandler = pScrn->pScreen->BlockHandler; + pScrn->pScreen->BlockHandler = CHIPSBlockHandler; } } } @@ -721,6 +720,7 @@ CHIPSDisplayVideo( tmp = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (tmp | 0x7)); + CHIPSHiQVSync(pScrn); } static int @@ -745,6 +745,9 @@ CHIPSPutImage( BoxRec dstBox; CARD32 tmp; + if (pScrn->pScreen->BlockHandler == CHIPSBlockHandler) + pScrn->pScreen->BlockHandler = cPtr->BlockHandler; + if(drw_w > 16384) drw_w = 16384; /* Clip */ @@ -791,7 +794,6 @@ CHIPSPutImage( if(!(pPriv->area = CHIPSAllocateMemory(pScrn, pPriv->area, new_h))) return BadAlloc; - /* copy data */ top = y1 >> 16; left = (x1 >> 16) & ~1; @@ -803,7 +805,7 @@ CHIPSPutImage( switch(id) { case 0x32315659: /* YV12 */ - top &= ~1; + top &= ~1; tmp = ((top >> 1) * srcPitch2) + (left >> 2); offset2 += tmp; offset3 += tmp; @@ -900,11 +902,11 @@ CHIPSBlockHandler ( pScreen->BlockHandler = CHIPSBlockHandler; - CHIPSHiQVSync(pScrn); if(pPriv->videoStatus & TIMER_MASK) { UpdateCurrentTime(); if(pPriv->videoStatus & OFF_TIMER) { if(pPriv->offTime < currentTime.milliseconds) { + CHIPSHiQVSync(pScrn); mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); pPriv->videoStatus = FREE_TIMER; @@ -917,6 +919,7 @@ CHIPSBlockHandler ( pPriv->area = NULL; } pPriv->videoStatus = 0; + pScreen->BlockHandler = cPtr->BlockHandler; } } } 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 2a53879e4..7f02d9481 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c @@ -9,7 +9,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.11 2000/06/21 17:28:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.12 2000/08/04 16:13:30 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -1760,10 +1760,12 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWPtr hwp = VGAHWPTR(pScrn); CirPtr pCir = CIRPTR(pScrn); - AlpRestore(pScrn); - vgaHWLock(hwp); + if(pScrn->vtSema) { + AlpRestore(pScrn); + vgaHWLock(hwp); + CirUnmapMem(pCir, pScrn->scrnIndex); + } - CirUnmapMem(pCir, pScrn->scrnIndex); if (pCir->AccelInfoRec) XAADestroyInfoRec(pCir->AccelInfoRec); pCir->AccelInfoRec = NULL; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c index 78e3ddada..723e3fadf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c @@ -13,7 +13,7 @@ * David Dawes, Andrew E. Mileski, Leonard N. Zubkoff, * Guy DESBIEF, Itai Nahshon. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.30 2000/06/21 17:28:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.31 2000/08/04 16:13:30 eich Exp $ */ #define EXPERIMENTAL @@ -1727,14 +1727,15 @@ LgCloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWPtr hwp = VGAHWPTR(pScrn); CirPtr pCir = CIRPTR(pScrn); + if(pScrn->vtSema) { LgRestore(pScrn); - if (pCir->HWCursor) - LgHideCursor(pScrn); + LgHideCursor(pScrn); vgaHWLock(hwp); - + CirUnmapMem(pCir, pScrn->scrnIndex); + } if (pCir->AccelInfoRec) XAADestroyInfoRec(pCir->AccelInfoRec); @@ -1801,17 +1802,23 @@ static Bool LgSaveScreen(ScreenPtr pScreen, int mode) { CirPtr pCir = CIRPTR(xf86Screens[pScreen->myNum]); + ScrnInfoPtr pScrn = NULL; Bool unblank; unblank = xf86IsUnblank(mode); - - if (unblank) + + if (pScreen != NULL) + pScrn = xf86Screens[pScreen->myNum]; + + if (pScrn != NULL && pScrn->vtSema) { + if (unblank) /* Power up the palette DAC */ memwb(0xB0,memrb(0xB0) & 0x7F); - else + else /* Power down the palette DAC */ memwb(0xB0,memrb(0xB0) | 0x80); - + } + return vgaHWSaveScreen(pScreen, mode); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c index 6a8560af3..bcff1c0e4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c @@ -26,18 +26,18 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c,v 1.1 2000/02/13 00:56:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_bank.c,v 1.2 2000/07/26 01:52:18 tsi Exp $ */ #define PSZ 8 -/* Everything using inb/outb, etc needs "compiler.h" */ -#include "compiler.h" - /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" +/* Everything using inb/outb, etc needs "compiler.h" */ +#include "compiler.h" + /* Drivers for PCI hardware need this */ #include "xf86PciInfo.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c index 95659094f..1dff06f84 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c @@ -26,9 +26,8 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.9 2000/06/21 17:28:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.11 2000/07/26 01:52:18 tsi Exp $ */ -#include "compiler.h" #include "fb.h" #include "mibank.h" #include "micmap.h" @@ -42,6 +41,7 @@ #include "vgaHW.h" #include "xf86RAC.h" #include "xf86Resources.h" +#include "compiler.h" #include "cyrix.h" @@ -301,6 +301,7 @@ CYRIXProbe(DriverPtr drv, int flags) int i, numDevSections, numUsed, *usedChips; GDevPtr *devSections; ScrnInfoPtr pScrn; + Bool foundScreen = FALSE; /* * The aim here is to find all cards that this driver can handle, @@ -332,13 +333,15 @@ CYRIXProbe(DriverPtr drv, int flags) if (numUsed <= 0) return FALSE; + foundScreen = TRUE; + /* Free it since we don't need that list after this */ xfree(devSections); - for (i=0; i < numUsed; i++) { + if (!(flags & PROBE_DETECT)) { + for (i=0; i < numUsed; i++) { - - /* Fill in what we can of the ScrnInfoRec */ + /* Fill in what we can of the ScrnInfoRec */ pScrn = NULL; if ((pScrn = xf86ConfigIsaEntity(pScrn, 0, usedChips[i], CYRIXISAChipsets, NULL, @@ -358,8 +361,9 @@ CYRIXProbe(DriverPtr drv, int flags) return (TRUE); } xfree(usedChips); + } } - return (TRUE); + return (foundScreen); } static int @@ -498,9 +502,6 @@ CYRIXPreInit(ScrnInfoPtr pScrn, int flags) /* end GGI MediaGX driver based code */ if (padsize == 0) return (FALSE); - if (flags & PROBE_DETECT) - return TRUE; - xf86ErrorF("%s: GX_BASE: 0x%x\n",CYRIX_NAME, physbase); xf86ErrorF("%s: Scratchpad size: %d kbytes\n",CYRIX_NAME, padsize); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c index de655dbdc..42b41ede2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c @@ -26,12 +26,12 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c,v 1.2 2000/04/19 16:57:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_helper.c,v 1.3 2000/07/26 01:52:19 tsi Exp $ */ #include "cyrix.h" -#include "compiler.h" #include "vgaHW.h" #include "xf86_ansic.h" +#include "compiler.h" #define CYRIXmarkLinesDirty { \ int k = 0; \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c index ce84e6475..389c4a801 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.22 2000/06/13 02:28:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.23 2000/08/11 17:27:13 dawes Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -56,6 +56,7 @@ static Bool FBDevScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); static Bool FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool FBDevSaveScreen(ScreenPtr pScreen, int mode); +static void FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); /* -------------------------------------------------------------------- */ @@ -740,6 +741,10 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if(!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, NULL, flags)) return FALSE; +#ifdef DPMSExtension + xf86DPMSInit(pScreen, FBDevDPMSSet, 0); +#endif + pScreen->SaveScreen = FBDevSaveScreen; /* Wrap the current CloseScreen function */ @@ -778,3 +783,12 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen) pScreen->CloseScreen = fPtr->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } + + +#ifdef DPMSExtension +static void +FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +{ + fbdevHWDPMSSet(pScrn, mode, flags); +} +#endif 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 d961ef1ad..4463cb90b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c @@ -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.89 2000/06/22 10:40:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.91 2000/07/09 21:02:18 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -702,7 +702,6 @@ GLINTProbe(DriverPtr drv, int flags) pPci = xf86GetPciInfoForEntity(usedChips[i]); - /* Only claim other chips when GAMMA is used */ if (pPci->chipType == PCI_CHIP_GAMMA) { while (*checkusedPci != NULL) { @@ -1304,6 +1303,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) Permedia3PreInit(pScrn, pGlint); 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 */ @@ -2679,11 +2681,6 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags) return; } - if (pGlint->VGAcore) { - vgaHWPtr hwp; - hwp = VGAHWPTR(pScrn); - } - base = ((y * pScrn->displayWidth + x) >> 1) >> pGlint->BppShift; if (pScrn->bitsPerPixel == 24) base *= 3; @@ -2822,9 +2819,9 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pGlint->FBDev) fbdevHWRestore(pScrn); else { - GLINTRestore(pScrn); - if (pGlint->VGAcore) - vgaHWLock(VGAHWPTR(pScrn)); + GLINTRestore(pScrn); + if (pGlint->VGAcore) + vgaHWLock(VGAHWPTR(pScrn)); } GLINTUnmapMem(pScrn); } @@ -2937,22 +2934,27 @@ GLINTSaveScreen(ScreenPtr pScreen, int mode) unblank = xf86IsUnblank(mode); - 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: - temp = GLINT_READ_REG(PMVideoControl); - if (unblank) temp |= 1; - else temp &= 0xFFFFFFFE; - GLINT_SLOW_WRITE_REG(temp, PMVideoControl); - break; - case PCI_VENDOR_3DLABS_CHIP_500TX: - case PCI_VENDOR_3DLABS_CHIP_300SX: - case PCI_VENDOR_3DLABS_CHIP_MX: - break; + if (unblank) + SetTimeSinceLastInputEvent(); + + if ((pScrn != NULL ) && pScrn->vtSema) { + 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: + temp = GLINT_READ_REG(PMVideoControl); + if (unblank) temp |= 1; + else temp &= 0xFFFFFFFE; + GLINT_SLOW_WRITE_REG(temp, PMVideoControl); + break; + case PCI_VENDOR_3DLABS_CHIP_500TX: + case PCI_VENDOR_3DLABS_CHIP_300SX: + case PCI_VENDOR_3DLABS_CHIP_MX: + break; + } } TRACE_EXIT("GLINTSaveScreen"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c index 0b31f8850..962cdeda1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c,v 1.18 2000/02/12 20:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c,v 1.19 2000/07/09 21:02:20 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -164,7 +164,7 @@ Permedia2Init(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->glintRegs[PMVbEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; /* The hw cursor needs /VSYNC to recognize vert retrace. We'll stick - both sync lines to active low here and if needed invert them + both sync lines to active high here and if needed invert them using the RAMDAC's MCR below. */ pReg->glintRegs[PMVideoControl >> 3] = (1 << 5) | (1 << 3) | 1; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c index 84dffef6b..370f51514 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.13 2000/05/10 18:55:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.16 2000/07/11 14:19:58 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -195,7 +195,7 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!(mode->Flags & V_PHSYNC)) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ if (!(mode->Flags & V_PVSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x04; /* invert vsync */ + pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ switch (pScrn->bitsPerPixel) { 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 7a8f6a440..f92c9bdd6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c @@ -27,7 +27,7 @@ * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.3 2000/06/12 10:11:38 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.4 2000/07/09 21:02:21 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -135,7 +135,10 @@ Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) if(size == 64) break; } /* Correct memory amount since fail */ - size = size / 2; + if (size != 1) + size = size / 2; + else + return 1*1024; /* Just to make sure */ if (PM3QuickFillMemory(pScrn,size)) return size*1024; @@ -271,7 +274,7 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode) 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 + both sync lines to active high here and if needed invert them using the RAMDAC's RDSyncControl below. */ pReg->glintRegs[PMVideoControl >> 3] = (1 << 5) | (1 << 3) | 1; @@ -305,7 +308,7 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!(mode->Flags & V_PHSYNC)) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ if (!(mode->Flags & V_PVSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x04; /* invert vsync */ + pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ switch (pScrn->bitsPerPixel) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile index c40e94225..8c4c521c0 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.9 2000/06/30 17:15:11 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.10 2000/08/01 19:03:15 dawes Exp $ XCOMM XCOMM This is the Imakefile for the i810 driver. XCOMM @@ -15,10 +15,10 @@ DRIDEFINES = $(GLX_DEFINES) #endif SRCS = i810_driver.c i810_cursor.c i810_accel.c i810_io.c \ - i810_memory.c i810_wmark.c i810_dga.c $(DRISRCS) + i810_memory.c i810_wmark.c i810_dga.c i810_video.c $(DRISRCS) OBJS = i810_driver.o i810_cursor.o i810_accel.o i810_io.o \ - i810_memory.o i810_wmark.o i810_dga.o $(DRIOBJS) + i810_memory.o i810_wmark.o i810_dga.o i810_video.o $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h index c0418c046..f218cf657 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h @@ -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.h,v 1.9 2000/06/22 17:44:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.13 2000/08/03 02:30:24 dawes Exp $ */ /* * Authors: @@ -36,12 +36,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _I810_H_ #define _I810_H_ +#include "xf86_ansic.h" #include "compiler.h" #include "xf86PciInfo.h" #include "xf86Pci.h" #include "i810_reg.h" #include "xaa.h" #include "xf86Cursor.h" +#include "xf86xv.h" #ifdef XF86DRI #include "xf86drm.h" @@ -124,6 +126,10 @@ typedef struct { unsigned int Fence[8]; + unsigned short OverlayActiveStart; + unsigned short OverlayActiveEnd; + + } I810RegRec, *I810RegPtr; typedef struct _I810Rec { @@ -142,7 +148,9 @@ typedef struct _I810Rec { I810MemRange TexMem; I810MemRange Scratch; I810MemRange BufferMem; - + I810MemRange OverlayBuf0; + I810MemRange OverlayBuf1; + int auxPitch; int auxPitchBits; @@ -150,6 +158,9 @@ typedef struct _I810Rec { int CursorOffset; int CursorPhysical; int CursorStart; + int OverlayPhysical; + int OverlayStart; + DGAModePtr DGAModes; int numDGAModes; @@ -168,6 +179,15 @@ typedef struct _I810Rec { int gartfd; int LmFreqSel; + + int VramKey; + long VramOffset; + int DcacheKey; + long DcacheOffset; + int HwcursKey; + long HwcursOffset; + + int GttBound; I810MemRange DcacheMem; I810MemRange SysMem; @@ -184,7 +204,8 @@ typedef struct _I810Rec { XAAInfoRecPtr AccelInfoRec; xf86CursorInfoPtr CursorInfoRec; CloseScreenProcPtr CloseScreen; - + ScreenBlockHandlerProcPtr BlockHandler; + I810WriteIndexedByteFunc writeControl; I810ReadIndexedByteFunc readControl; I810WriteByteFunc writeStandard; @@ -207,8 +228,11 @@ typedef struct _I810Rec { Bool agpAcquired; drmHandle buffer_map; drmHandle ring_map; + drmHandle overlay_map; #endif Bool agpAcquired2d; + + XF86VideoAdaptorPtr adaptor; } I810Rec; #define I810PTR(p) ((I810Ptr)((p)->driverPrivate)) @@ -246,6 +270,9 @@ extern void I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y); extern int I810AllocateGARTMemory( ScrnInfoPtr pScrn ); extern void I810FreeGARTMemory( ScrnInfoPtr pScrn ); +extern Bool I810BindGARTMemory( ScrnInfoPtr pScrn ); +extern Bool I810UnbindGARTMemory( ScrnInfoPtr pScrn ); + extern Bool I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void I810AdjustFrame(int scrnIndex, int x, int y, int flags); @@ -267,6 +294,7 @@ extern void I810RefreshRing(ScrnInfoPtr pScrn); extern void I810EmitFlush(ScrnInfoPtr pScrn); extern void I810EmitInvarientState(ScrnInfoPtr pScrn); +extern Bool I810DGAInit(ScreenPtr pScreen); #define minb(p) *(volatile CARD8 *)(pI810->MMIOBase + (p)) #define moutb(p,v) *(volatile CARD8 *)(pI810->MMIOBase + (p)) = (v) 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 ebaeba30d..4695e7b30 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.6 2000/06/23 23:43:44 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.9 2000/08/03 02:30:25 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -332,7 +332,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) drmVersionPtr version = drmGetVersion(pI810->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || + version->version_minor != 1 || version->version_patchlevel < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, @@ -562,6 +562,38 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) pI810->CursorPhysical = 0; } + /* Steal some of the excess cursor space for the overlay regs, + * then allocate 202*2 pages for the overlay buffers. + */ + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; + + /* Allocate overlay memory */ + I810AllocHigh( &(pI810->OverlayBuf0), &(pI810->SysMem), + 202 * 4096); + + if(pI810->OverlayBuf0.Start == 0 || + pI810->OverlayBuf0.End - pI810->OverlayBuf0.Start > + 202 * 4096) { + ErrorF("Not enough memory for overlay buffer\n"); + DRICloseScreen(pScreen); + return FALSE; + } + I810AllocHigh( &(pI810->OverlayBuf1), &(pI810->SysMem), + 202 * 4096); + + if(pI810->OverlayBuf1.Start == 0 || + pI810->OverlayBuf1.End - pI810->OverlayBuf1.Start > + 202 * 4096) { + ErrorF("Not enough memory for overlay buffer\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + /* drmAddMap happens later to preserve index order */ + + + I810SetTiledMemory(pScrn, 1, pI810->DepthBuffer.Start, i810_pitches[pitch_idx], @@ -674,6 +706,25 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", bufs, I810_DMA_BUF_SZ); + /* add the drm map for the overlay. It is added here so that the index + * numbers of the other maps didn't have to be changed. + */ + if(drmAddMap(pI810->drmSubFD, (drmHandle)pI810->OverlayBuf0.Start, + pI810->OverlayBuf0.Size, DRM_AGP, 0, + &pI810->overlay_map) < 0) { + ErrorF("drmAddMap(overlay_map) failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + if(drmAddMap(pI810->drmSubFD, (drmHandle)pI810->OverlayBuf1.Start, + pI810->OverlayBuf1.Size, DRM_AGP, 0, + &pI810->overlay_map) < 0) { + ErrorF("drmAddMap(overlay_map) failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + I810InitDma(pScrn); /* Okay now initialize the dma engine */ 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 c02b14da4..00e1b6a09 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.15 2000/06/22 17:44:04 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.18 2000/08/11 17:27:14 dawes Exp $ */ /* * Authors: @@ -1101,6 +1101,10 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, pI810->writeControl(pI810, GRX, ADDRESS_MAPPING, temp); + /* Setting the OVRACT Register for video overlay*/ + OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart); + + /* Turn on DRAM Refresh */ @@ -1132,6 +1136,7 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, temp = INREG8( PIXPIPE_CONFIG_1 ); temp &= ~DISPLAY_COLOR_MODE; + temp &= 0xEF; /* Restore the CRT control bit */ temp |= i810Reg->PixelPipeCfg1; OUTREG8( PIXPIPE_CONFIG_1, temp ); @@ -1342,6 +1347,8 @@ I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) else i810Reg->PixelPipeCfg0 = DAC_8_BIT; + /* Do not delay CRT Blank: needed for video overlay */ + i810Reg->PixelPipeCfg1 |= 0x10; /* Turn on Extended VGA Interpretation */ i810Reg->IOControl = EXTENDED_CRTC_CNTL; @@ -1362,6 +1369,20 @@ I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) i810Reg->ExtHorizTotal = ((mode->CrtcHTotal >> 3) - 5) >> 8; i810Reg->ExtHorizBlank = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x40) >> 6; + /* + * The following workaround is needed to get video overlay working + * at 1024x768 display resolution. + */ + if ((mode->CrtcVDisplay == 768) && (i810Reg->ExtVertBlankStart == 3)) + { + i810Reg->ExtVertBlankStart = 2; + } + + /* OVRACT Register */ + i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; + i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; + + /* Turn on interlaced mode if necessary */ if (mode->Flags & V_INTERLACE) i810Reg->InterlaceControl = INTERLACE_ENABLE; @@ -1755,8 +1776,10 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } } + I810InitVideo(pScreen); + #ifdef XF86DRI - if (pI810->LpRing.mem.Start == 0) { + if (pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { pI810->directRenderingEnabled = 0; I810DRICloseScreen(pScreen); } @@ -1852,6 +1875,9 @@ I810EnterVT(int scrnIndex, int flags) { if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("\n\nENTER VT\n"); + if (! I810BindGARTMemory(pScrn)) + return FALSE; + #ifdef XF86DRI if (pI810->directRenderingEnabled) { if (I810_DEBUG & DEBUG_VERBOSE_DRI) @@ -1889,6 +1915,10 @@ I810LeaveVT(int scrnIndex, int flags) { I810Sync( pScrn ); } I810Restore(pScrn); + + if (! I810UnbindGARTMemory(pScrn)) + return; + vgaHWLock(hwp); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c index b5c07798d..74931388c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.9 2000/06/20 05:08:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.12 2000/08/04 03:51:45 tsi Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -76,7 +76,7 @@ int I810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) { -#ifdef linux +#ifdef AGPIOC_ACQUIRE struct _agp_info agpinf; struct _agp_bind bind; struct _agp_allocate alloc; @@ -134,6 +134,8 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) bind.pg_start = 0; bind.key = alloc.key; + pI810->VramOffset = (off_t) bind.pg_start; + pI810->VramKey = bind.key; if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -169,6 +171,8 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) if (ioctl(pI810->gartfd, AGPIOC_ALLOCATE, &alloc) == 0) { bind.pg_start = tom / 4096; bind.key = alloc.key; + pI810->DcacheOffset= (off_t) bind.pg_start; + pI810->DcacheKey = bind.key; if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -187,6 +191,11 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) * system memory from which to upload the cursor. We get this from * the agpgart module using a special memory type. */ + + /* 4k for the cursor is excessive, I'm going to steal 3k for + * overlay registers later + */ + alloc.pg_count = 1; alloc.type = 2; @@ -198,6 +207,8 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) } else { bind.pg_start = tom / 4096; bind.key = alloc.key; + pI810->HwcursOffset = (off_t) bind.pg_start; + pI810->HwcursKey = bind.key; if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -211,6 +222,14 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) } } + /* Overlay register buffer -- Just like the cursor, the i810 needs a + * physical address in system memory from which to upload the overlay + * registers. + */ + if (pI810->CursorStart != 0) { + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; + } return TRUE; @@ -219,8 +238,6 @@ int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) #endif } - - void I810FreeGARTMemory( ScrnInfoPtr pScrn ) { #ifdef linux @@ -305,3 +322,62 @@ void I810SetTiledMemory(ScrnInfoPtr pScrn, i810Reg->Fence[nr] = val; } + +Bool +I810BindGARTMemory( ScrnInfoPtr pScrn ) +{ +#ifdef AGPIOC_ACQUIRE + I810Ptr pI810 = I810PTR(pScrn); + struct _agp_bind bind; + + if (!pI810->GttBound) { + if (ioctl(pI810->gartfd, AGPIOC_ACQUIRE, 0) != 0) + FatalError ("i810: Unable to acquire agp interface on VT switch!!\n"); + bind.pg_start = (off_t) pI810->VramOffset; + bind.key = pI810->VramKey; + if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) + FatalError("i810: Unable to bind agp memory on VT switch!!\n"); + bind.pg_start = (off_t) pI810->DcacheOffset; + bind.key = pI810->DcacheKey; + if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) + FatalError("i810: Unable to bind agp dcache on VT switch!!\n"); + bind.pg_start = (off_t) pI810->HwcursOffset; + bind.key = pI810->HwcursKey; + if (ioctl(pI810->gartfd, AGPIOC_BIND, &bind) != 0) + FatalError("i810: Unable to bind agp hardware cursor on VT switch!!\n"); + pI810->GttBound = 1; + } + return TRUE; +#else + return FALSE; +#endif +} + +Bool +I810UnbindGARTMemory( ScrnInfoPtr pScrn ) +{ +#ifdef AGPIOC_ACQUIRE + I810Ptr pI810 = I810PTR(pScrn); + struct _agp_unbind unbind; + + if (pI810->GttBound) { + unbind.priority = 0; + unbind.key = pI810->VramKey; + if (ioctl(pI810->gartfd, AGPIOC_UNBIND, &unbind) != 0) + FatalError("i810: Unable to bind agp memory on VT switch!!\n"); + unbind.key = pI810->DcacheKey; + if (ioctl(pI810->gartfd, AGPIOC_UNBIND, &unbind) != 0) + FatalError("i810: Unable to bind agp dcache on VT switch!!\n"); + unbind.key = pI810->HwcursKey; + if (ioctl(pI810->gartfd, AGPIOC_UNBIND, &unbind) != 0) + FatalError("i810: Unable to bind agp hardware cursor on VT switch!!\n"); + if (ioctl(pI810->gartfd, AGPIOC_RELEASE, 0) != 0) + FatalError("i810: Unable to release agp interface on VT switch!!\n"); + pI810->GttBound = 0; + } + + return TRUE; +#else + return FALSE; +#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 new file mode 100644 index 000000000..46706ca98 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c @@ -0,0 +1,1048 @@ +/*************************************************************************** + +Copyright 2000 Intel Corporation. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.3 2000/08/03 12:24:02 dawes Exp $ */ + +/* + * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. + * + * 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" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "i810.h" +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +static XF86VideoAdaptorPtr I810SetupImageVideo(ScreenPtr); +static void I810StopVideo(ScrnInfoPtr, pointer, Bool); +static int I810SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int I810GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void I810QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int I810PutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int I810QueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); + +static void I810BlockHandler(int, pointer, pointer, pointer); + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey; + +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 +#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT) + +#define OVERLAY_UPDATE(p) OUTREG(0x30000, p | 0x80000000); + +/* + * OV0CMD - Overlay Command Register + */ +#define VERTICAL_CHROMINANCE_FILTER 0x70000000 +#define VC_SCALING_OFF 0x00000000 +#define VC_LINE_REPLICATION 0x10000000 +#define VC_UP_INTERPOLATION 0x20000000 +#define VC_PIXEL_DROPPING 0x50000000 +#define VC_DOWN_INTERPOLATION 0x60000000 +#define VERTICAL_LUMINANCE_FILTER 0x0E000000 +#define VL_SCALING_OFF 0x00000000 +#define VL_LINE_REPLICATION 0x02000000 +#define VL_UP_INTERPOLATION 0x04000000 +#define VL_PIXEL_DROPPING 0x0A000000 +#define VL_DOWN_INTERPOLATION 0x0C000000 +#define HORIZONTAL_CHROMINANCE_FILTER 0x01C00000 +#define HC_SCALING_OFF 0x00000000 +#define HC_LINE_REPLICATION 0x00400000 +#define HC_UP_INTERPOLATION 0x00800000 +#define HC_PIXEL_DROPPING 0x01400000 +#define HC_DOWN_INTERPOLATION 0x01800000 +#define HORIZONTAL_LUMINANCE_FILTER 0x00380000 +#define HL_SCALING_OFF 0x00000000 +#define HL_LINE_REPLICATION 0x00080000 +#define HL_UP_INTERPOLATION 0x00100000 +#define HL_PIXEL_DROPPING 0x00280000 +#define HL_DOWN_INTERPOLATION 0x00300000 + +#define Y_ADJUST 0x00010000 +#define SOURCE_FORMAT 0x00003C00 +#define RGB_555 0x00000800 +#define RGB_565 0x00000C00 +#define YUV_422 0x00002000 +#define YUV_411 0x00002400 +#define YUV_420 0x00003000 +#define YUV_410 0x00003800 +#define BUFFER_AND_FIELD 0x00000006 +#define BUFFER0_FIELD0 0x00000000 +#define BUFFER1_FIELD0 0x00000004 +#define OVERLAY_ENABLE 0x00000001 + +/* + * DOV0STA - Display/Overlay 0 Status Register + */ +#define DOV0STA 0x30008 + +#define MINUV_SCALE 0x1 + +void I810InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + if (pScrn->bitsPerPixel != 8) + { + newAdaptor = I810SetupImageVideo(pScreen); + } + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + 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++; + } + } + } + + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 2 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = +{ + {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} +}; + +#define NUM_IMAGES 2 + +static XF86ImageRec Images[NUM_IMAGES] = +{ + { + 0x32595559, + XvYUV, + LSBFirst, + {'Y','U','Y','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 16, + XvPacked, + 1, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 1, 1, + {'Y','U','Y','V', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + }, + { + 0x32315659, + XvYUV, + LSBFirst, + {'Y','V','1','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 12, + XvPlanar, + 3, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 2, 2, + {'Y','V','U', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom + } +}; + +typedef struct { + CARD32 OBUF_0Y; + CARD32 OBUF_1Y; + CARD32 OBUF_0U; + CARD32 OBUF_0V; + CARD32 OBUF_1U; + CARD32 OBUF_1V; + CARD32 OV0STRIDE; + CARD32 YRGB_VPH; + CARD32 UV_VPH; + CARD32 HORZ_PH; + CARD32 INIT_PH; + CARD32 DWINPOS; + CARD32 DWINSZ; + CARD32 SWID; + CARD32 SWIDQW; + CARD32 SHEIGHT; + CARD32 YRGBSCALE; + CARD32 UVSCALE; + CARD32 OV0CLRC0; + CARD32 OV0CLRC1; + CARD32 DCLRKV; + CARD32 DCLRKM; + CARD32 SCLRKVH; + CARD32 SCLRKVL; + CARD32 SCLRKM; + CARD32 OV0CONF; + CARD32 OV0CMD; +} I810OverlayRegRec, *I810OverlayRegPtr; + +typedef struct { + CARD32 YBuf0VirtAddr; + CARD32 UBuf0VirtAddr; + CARD32 VBuf0VirtAddr; + + CARD32 YBuf1VirtAddr; + CARD32 UBuf1VirtAddr; + CARD32 VBuf1VirtAddr; + + unsigned char currentBuf; + + unsigned char brightness; + unsigned char contrast; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; +} I810PortPrivRec, *I810PortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (I810PortPrivPtr)((I810PTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +void I810ResetVideo(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + + /* + * Default to maximum image size in YV12 + */ + + overlay->OBUF_0Y = pI810->OverlayBuf0.Start; + overlay->OBUF_1Y = pI810->OverlayBuf1.Start; + overlay->OBUF_0U = overlay->OBUF_0Y + Y_BUF_SIZE; + overlay->OBUF_0V = overlay->OBUF_0U + (Y_BUF_SIZE >> 2); + overlay->OBUF_1U = overlay->OBUF_1Y + Y_BUF_SIZE; + overlay->OBUF_1V = overlay->OBUF_1U + (Y_BUF_SIZE >> 2); + overlay->OV0STRIDE = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15); /* YV12 */ + overlay->YRGB_VPH = 0; + overlay->UV_VPH = 0; + overlay->HORZ_PH = 0; + overlay->INIT_PH = 0; + overlay->DWINPOS = 0; + overlay->DWINSZ = (IMAGE_MAX_HEIGHT << 16) | IMAGE_MAX_WIDTH; + overlay->SWID = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15); + overlay->SWIDQW = (IMAGE_MAX_WIDTH >> 3) | (IMAGE_MAX_WIDTH << 12); + overlay->SHEIGHT = IMAGE_MAX_HEIGHT | (IMAGE_MAX_HEIGHT << 15); + overlay->YRGBSCALE = 0x80004000; /* scale factor 1 */ + overlay->UVSCALE = 0x80004000; /* scale factor 1 */ + overlay->OV0CLRC0 = 0x4000; /* brightness: 0 contrast: 1.0 */ + overlay->OV0CLRC1 = 0x80; /* saturation: bypass */ + overlay->DCLRKV = 0; /* destination color key: 0 */ + overlay->DCLRKM = 0x80FFFFFF; /* destination color key enable */ + overlay->SCLRKVH = 0; + overlay->SCLRKVL = 0; + overlay->SCLRKM = 0; /* source color key disable */ + overlay->OV0CONF = 0; /* two 720 pixel line buffers */ + + overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | + YUV_420; + + OVERLAY_UPDATE(pI810->OverlayPhysical); +} + + +static XF86VideoAdaptorPtr +I810SetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + XF86VideoAdaptorPtr adapt; + I810PortPrivPtr pPriv; + + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(I810PortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "I810 Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPriv = (I810PortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = 2; + adapt->nAttributes = 3; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = I810StopVideo; + adapt->SetPortAttribute = I810SetPortAttribute; + adapt->GetPortAttribute = I810GetPortAttribute; + adapt->QueryBestSize = I810QueryBestSize; + adapt->PutImage = I810PutImage; + adapt->QueryImageAttributes = I810QueryImageAttributes; + + pPriv->colorKey = 0; + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 128; + +#ifndef XF86DRI + if (!I810AllocHigh(&(pI810->OverlayBuf0), &(pI810->SysMem), Y_BUF_SIZE*2)) + return NULL; + if (!I810AllocHigh(&(pI810->OverlayBuf1), &(pI810->SysMem), Y_BUF_SIZE*2)) + return NULL; +#endif + + if((!pI810->OverlayBuf0.Start) || (!pI810->OverlayBuf1.Start)) + return NULL; + + pPriv->YBuf0VirtAddr = (CARD32) (pI810->FbBase + pI810->OverlayBuf0.Start); + pPriv->UBuf0VirtAddr = pPriv->YBuf0VirtAddr + Y_BUF_SIZE; + pPriv->VBuf0VirtAddr = pPriv->UBuf0VirtAddr + (Y_BUF_SIZE >> 2); + + pPriv->YBuf1VirtAddr = (CARD32) (pI810->FbBase + pI810->OverlayBuf1.Start); + pPriv->UBuf1VirtAddr = pPriv->YBuf1VirtAddr + Y_BUF_SIZE; + pPriv->VBuf1VirtAddr = pPriv->UBuf1VirtAddr + (Y_BUF_SIZE >> 2); + + pPriv->currentBuf = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pI810->adaptor = adapt; + + pI810->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = I810BlockHandler; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + I810ResetVideo(pScrn); + + return adapt; +} + + +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; +} + + +/* I810ClipVideo - + + 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 (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +static void +I810ClipVideo( + BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void +I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + I810Ptr pI810 = I810PTR(pScrn); + + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(exit) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + overlay->OV0CMD &= 0xFFFFFFFE; + OVERLAY_UPDATE(pI810->OverlayPhysical); + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } + +} + +static int +I810SetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + I810Ptr pI810 = I810PTR(pScrn); + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + + if(attribute == xvBrightness) { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + overlay->OV0CLRC0 &= 0xFFFFFF00; + overlay->OV0CLRC0 |= value; + OVERLAY_UPDATE(pI810->OverlayPhysical); + } else + if(attribute == xvContrast) { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + overlay->OV0CLRC0 &= 0xFFFE00FF; + overlay->OV0CLRC0 |= value << 9; + OVERLAY_UPDATE(pI810->OverlayPhysical); + } else + if(attribute == xvColorKey) { + pPriv->colorKey = value; + overlay->DCLRKV = value; + OVERLAY_UPDATE(pI810->OverlayPhysical); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else return BadMatch; + + return Success; +} + +static int +I810GetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + + if(attribute == xvBrightness) { + *value = pPriv->brightness; + } else + if(attribute == xvContrast) { + *value = pPriv->contrast; + } else + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else return BadMatch; + + return Success; +} + +static void +I810QueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + *p_w = drw_w; + *p_h = drw_h; + + if(*p_w > 16384) *p_w = 16384; +} + + +static void +I810CopyPackedData( + ScrnInfoPtr pScrn, + unsigned char *buf, + int srcPitch, + int top, + int left, + int h, + int w + ) +{ + I810Ptr pI810 = I810PTR(pScrn); + I810PortPrivPtr pPriv = pI810->adaptor->pPortPrivates[0].ptr; + unsigned char *src, *dst; + + src = buf + (top*srcPitch) + (left<<1); + + if (pPriv->currentBuf == 0) + dst = (unsigned char*) pPriv->YBuf0VirtAddr; + else + dst = (unsigned char*) pPriv->YBuf1VirtAddr; + + w <<= 1; + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += 720*2; + } +} + +static void +I810CopyPlanarData( + ScrnInfoPtr pScrn, + unsigned char *buf, + int srcPitch, + int top, + int left, + int h, + int w + ) +{ + I810Ptr pI810 = I810PTR(pScrn); + I810PortPrivPtr pPriv = pI810->adaptor->pPortPrivates[0].ptr; + int i; + unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3; + + /* Copy Y data */ + src1 = buf + (top*srcPitch) + left; + if (pPriv->currentBuf == 0) + dst1 = (unsigned char *) pPriv->YBuf0VirtAddr; + else + dst1 = (unsigned char *) pPriv->YBuf1VirtAddr; + + for (i = 0; i < h; i++) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += 720; + } + + /* Copy V data */ + src2 = buf + (h*srcPitch) + (top*(srcPitch>>1)) + (left>>1); + if (pPriv->currentBuf == 0) + dst2 = (unsigned char *) pPriv->VBuf0VirtAddr; + else + dst2 = (unsigned char *) pPriv->VBuf1VirtAddr; + + for (i = 0; i < h/2; i++) { + memcpy(dst2, src2, w/2); + src2 += srcPitch>>1; + dst2 += 360; + } + + /* Copy U data */ + src3 = buf + (h*srcPitch) + (h*srcPitch/4) + (top*(srcPitch>>1)) + (left>>1); + if (pPriv->currentBuf == 0) + dst3 = (unsigned char *) pPriv->UBuf0VirtAddr; + else + dst3 = (unsigned char *) pPriv->UBuf1VirtAddr; + + for (i = 0; i < h/2; i++) { + memcpy(dst3, src3, w/2); + src3 += srcPitch>>1; + dst3 += 360; + } +} + +static void +I810DisplayVideo( + ScrnInfoPtr pScrn, + int id, + short width, short height, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + I810Ptr pI810 = I810PTR(pScrn); + I810PortPrivPtr pPriv = pI810->adaptor->pPortPrivates[0].ptr; + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV = 0, xscaleFractUV = 0, yscaleIntUV = 0, yscaleFractUV = 0; + unsigned int swidth; + + switch(id) { + case 0x32315659: /* YV12 */ + swidth = (width + 7) & ~7; + overlay->SWID = (swidth << 15) | swidth; + overlay->SWIDQW = (swidth << 12) | (swidth >> 3); + break; + case 0x32595559: /* YUY2 */ + default: + swidth = ((width + 3) & ~3) << 1; + overlay->SWID = swidth; + overlay->SWIDQW = swidth >> 3; + break; + } + + overlay->SHEIGHT = height | (height << 15); + overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; + overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | + (dstBox->x2 - dstBox->x1); + + /* + * Calculate horizontal and vertical scaling factors, default to 1:1 + */ + overlay->YRGBSCALE = 0x80004000; + overlay->UVSCALE = 0x80004000; + + /* + * Initially, YCbCr and Overlay Enable and + * vertical chrominance up interpolation and horozontal chrominance + * up interpolation + */ + overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | + OVERLAY_ENABLE; + + if ((drw_w != src_w) || (drw_h != src_h)) + { + xscaleInt = (src_w / drw_w) & 0x3; + xscaleFract = (src_w << 12) / drw_w; + yscaleInt = (src_h / drw_h) & 0x3; + yscaleFract = (src_h << 12) / drw_h; + + overlay->YRGBSCALE = (xscaleInt << 15) | + ((xscaleFract & 0xFFF) << 3) | + (yscaleInt) | + ((yscaleFract & 0xFFF) << 20); + + if (drw_w > src_w) + { + /* horizontal up-scaling */ + overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER; + overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER; + overlay->OV0CMD |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION); + } + + if (drw_h > src_h) + { + /* vertical up-scaling */ + overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER; + overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER; + overlay->OV0CMD |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION); + } + + if (drw_w < src_w) + { + /* horizontal down-scaling */ + overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER; + overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER; + overlay->OV0CMD |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION); + } + + if (drw_h < src_h) + { + /* vertical down-scaling */ + overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER; + overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER; + overlay->OV0CMD |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION); + } + + /* now calculate the UV scaling factor */ + + if (xscaleFract) + { + xscaleFractUV = xscaleFract >> MINUV_SCALE; + overlay->OV0CMD &= ~HC_DOWN_INTERPOLATION; + overlay->OV0CMD |= HC_UP_INTERPOLATION; + } + + if (xscaleInt) + { + xscaleIntUV = xscaleInt >> MINUV_SCALE; + if (xscaleIntUV) + { + overlay->OV0CMD &= ~HC_UP_INTERPOLATION; + } + } + + if (yscaleFract) + { + yscaleFractUV = yscaleFract >> MINUV_SCALE; + overlay->OV0CMD &= ~VC_DOWN_INTERPOLATION; + overlay->OV0CMD |= VC_UP_INTERPOLATION; + } + + if (yscaleInt) + { + yscaleIntUV = yscaleInt >> MINUV_SCALE; + if (yscaleIntUV) + { + overlay->OV0CMD &= ~VC_UP_INTERPOLATION; + overlay->OV0CMD |= VC_DOWN_INTERPOLATION; + } + } + + overlay->UVSCALE = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) | + ((yscaleFractUV & 0xFFF) << 20); + } + + switch(id) { + case 0x32315659: /* YV12 */ + overlay->OV0STRIDE = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15); + overlay->OV0CMD &= ~SOURCE_FORMAT; + overlay->OV0CMD |= YUV_420; + break; + case 0x32595559: /* YUY2 */ + overlay->OV0STRIDE = IMAGE_MAX_WIDTH << 1; + overlay->OV0CMD &= ~SOURCE_FORMAT; + overlay->OV0CMD |= YUV_422; + default: /* we may have to do something different here ? */ + break; + } + + overlay->OV0CMD &= ~BUFFER_AND_FIELD; + if (pPriv->currentBuf == 0) + overlay->OV0CMD |= BUFFER0_FIELD0; + else + overlay->OV0CMD |= BUFFER1_FIELD0; + + OVERLAY_UPDATE(pI810->OverlayPhysical); + + /* wait for the current buffer flipped in */ + while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf); + + /* buffer swap */ + if (pPriv->currentBuf == 0) + pPriv->currentBuf = 1; + else + pPriv->currentBuf = 0; +} + +static int +I810PutImage( + 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 +){ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + INT32 x1, x2, y1, y2; + int srcPitch; + int top, left, npixels, nlines; + BoxRec dstBox; + + if(drw_w > 16384) drw_w = 16384; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + switch(id) { + case 0x32315659: /* YV12 */ + srcPitch = (width + 3) & ~3; + break; + case 0x32595559: /* YUY2 */ + default: + srcPitch = (width << 1); + break; + } + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case 0x32315659: /* YV12 */ + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + I810CopyPlanarData(pScrn, buf, srcPitch, top, left, nlines, npixels); + break; + case 0x32595559: /* YUY2 */ + default: + nlines = ((y2 + 0xffff) >> 16) - top; + I810CopyPackedData(pScrn, buf, srcPitch, top, left, nlines, npixels); + break; + } + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + + I810DisplayVideo(pScrn, id, width, height, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + + +static int +I810QueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 720) *w = 720; + if(*h > 576) *h = 576; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case 0x32315659: /* YV12 */ + *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 0x32595559: /* YUY2 */ + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +static void +I810BlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + I810Ptr pI810 = I810PTR(pScrn); + I810PortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + + pScreen->BlockHandler = pI810->BlockHandler; + + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + + pScreen->BlockHandler = I810BlockHandler; + + if(pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < currentTime.milliseconds) { + /* Turn off the overlay */ + overlay->OV0CMD &= 0xFFFFFFFE; + OVERLAY_UPDATE(pI810->OverlayPhysical); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) { + /* + * If we want to allocate the buffers on-demand, then should + * free the YUV buffers here + */ + pPriv->videoStatus = 0; + } + } + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h index 7a0b625dc..84dcafe90 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.1 2000/06/14 00:16:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.3 2000/08/02 23:50:49 dawes Exp $ */ #ifndef _IMSTT_H #define _IMSTT_H @@ -22,6 +22,7 @@ typedef struct _IMSTTRec { long FBMapSize; unsigned long videoRam; unsigned long ramdac; + int rev; OptionInfoPtr Options; unsigned int Flags; CARD32 Bus; @@ -32,8 +33,13 @@ typedef struct _IMSTTRec { Bool InitDAC; Bool FBDev; int Chipset, ChipRev; + int ydir; unsigned long pitch; unsigned long ll; + unsigned long screen_width; + unsigned long sp; + unsigned long dp; + unsigned long cnt; unsigned long bltctl; unsigned short hes; unsigned short heb; @@ -51,6 +57,11 @@ typedef struct _IMSTTRec { unsigned char lckl_p[3]; } IMSTTRec, *IMSTTPtr; +#if 0 +#define IMSTTTRACE ErrorF +#else +#define IMSTTTRACE +#endif #define IMSTTPTR(p) ((IMSTTPtr)((p)->driverPrivate)) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c index 53f46bb13..6bee19f0a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.2 2000/06/14 02:36:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.4 2000/08/01 20:05:43 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -25,10 +25,10 @@ */ -#include "compiler.h" #include "Xarch.h" #include "xf86.h" #include "xf86_ansic.h" +#include "compiler.h" #include "xf86_OSproc.h" #include "xaa.h" #include "xf86PciInfo.h" @@ -55,10 +55,11 @@ static void IMSTTSetupForSolidFill(ScrnInfoPtr pScrn, int color, IMSTTPtr iptr = IMSTTPTR(pScrn); IMSTTMMIO_VARS(); + OUTREG(IMSTT_DP_OCTL, iptr->ll); + OUTREG(IMSTT_SP, iptr->ll); OUTREG(IMSTT_BI, 0xffffffff); OUTREG(IMSTT_MBC, 0xffffffff); OUTREG(IMSTT_CLR, color); - OUTREG(IMSTT_DP_OCTL, (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3))); } @@ -68,9 +69,13 @@ static void IMSTTSubsequentSolidFillRect(ScrnInfoPtr pScrn, IMSTTPtr iptr = IMSTTPTR(pScrn); IMSTTMMIO_VARS(); - OUTREG(IMSTT_DSA, y + x); - OUTREG(IMSTT_CNT, (h << 16) | w); - OUTREG(IMSTT_BLTCTL, 0x840); + OUTREG(IMSTT_DSA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3)); + OUTREG(IMSTT_S1SA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3)); + OUTREG(IMSTT_CNT, ((h - 1) << 16) | (w * (pScrn->bitsPerPixel >> 3) - 1)); + if (iptr->rev == 2) + OUTREG(IMSTT_BLTCTL, 0x200000); + else + OUTREG(IMSTT_BLTCTL, 0x840); } @@ -83,24 +88,28 @@ static void IMSTTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, unsigned long sp, dp, ll, cnt; iptr->bltctl = 0x05; - ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); - iptr->ll = ll; + ll = iptr->ll; sp = ll << 16; - cnt = pScrn->virtualY << 16; - if (xdir >= 0) { - dp = -(ll) & 0xffff; - sp |= dp; - } - if (ydir >= 0) { + + if (xdir > 0) { iptr->bltctl |= 0x80; - cnt |= -(pScrn->displayWidth) & 0xffff; + iptr->cnt = 1; } else { - cnt |= pScrn->displayWidth; + iptr->cnt = 0; } - OUTREG(IMSTT_SP, sp); - OUTREG(IMSTT_CNT, cnt); - OUTREG(IMSTT_DP_OCTL, dp); + if (ydir > 0) { + sp |= -(ll) & 0xffff; + dp = -(ll) & 0xffff; + iptr->ydir = 1; + } else { + sp |= ll; + dp = ll; + iptr->ydir = 0; + } + + iptr->sp = sp; + iptr->dp = dp; } @@ -111,15 +120,35 @@ static void IMSTTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, { IMSTTPtr iptr = IMSTTPTR(pScrn); IMSTTMMIO_VARS(); + unsigned long cnt; + + w--; + h--; + cnt = h << 16; - OUTREG(IMSTT_S1SA, x1 * iptr->ll * y1); - OUTREG(IMSTT_DSA, x2 * iptr->ll * y2); + if (iptr->cnt) { + x1 += w; + x2 += w; + cnt |= -(w) & 0xffff; + } + else + cnt |= w; + + if (iptr->ydir) { + y1 += h; + y2 += h; + } + + OUTREG(IMSTT_S1SA, y1 * iptr->ll + x1); + OUTREG(IMSTT_SP, iptr->sp); + OUTREG(IMSTT_DSA, y2 * iptr->ll + x2); + OUTREG(IMSTT_CNT, cnt); + OUTREG(IMSTT_DP_OCTL, iptr->dp); OUTREG(IMSTT_BLTCTL, iptr->bltctl); } - Bool IMSTTAccelInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -129,12 +158,18 @@ Bool IMSTTAccelInit(ScreenPtr pScreen) if (!(xaaptr = iptr->AccelInfoRec = XAACreateInfoRec())) return FALSE; + iptr->ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); + + iptr->screen_width = iptr->pitch = iptr->ll; + xaaptr->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER); xaaptr->Sync = IMSTTSync; + xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill; xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect; - xaaptr->ScreenToScreenCopyFlags = 0; + + xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; xaaptr->SetupForScreenToScreenCopy = IMSTTSetupForScreenToScreenCopy; xaaptr->SubsequentScreenToScreenCopy = IMSTTSubsequentScreenToScreenCopy; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c index c234619bd..de3b0e656 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.6 2000/06/22 16:59:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.8 2000/08/01 20:05:43 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -6,10 +6,6 @@ * XFree86 4.0 driver for the Integrated Micro Solutions * Twin Turbo 128 chipset * - * Credits: - * Sigurdur Asgeirsson, Jeffrey Kuskin, Ryan Nielsen - * for their work on imsttfb - * * 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 @@ -28,11 +24,13 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * + * Credits: + * Sigurdur Asgeirsson, Jeffrey Kuskin, Ryan Nielsen + * for their work on imsttfb * */ -#include "compiler.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -41,6 +39,7 @@ #include "xf86Version.h" #include "xf86Resources.h" #include "xf86fbman.h" +#include "compiler.h" #include "xaa.h" #include "mipointer.h" #include "micmap.h" @@ -86,8 +85,8 @@ static Bool IMSTTMapMem(ScrnInfoPtr pScrn); static void IMSTTUnmapMem(ScrnInfoPtr pScrn); static Bool IMSTTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void IMSTTAdjustFrame(int scrnIndex, int x, int y, int flags); -static Bool IMSTTCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool IMSTTSaveSCreen(ScreenPtr pScreen, int mode); +Bool IMSTTCloseScreen(int scrnIndex, ScreenPtr pScreen); +Bool IMSTTSaveScreen(ScreenPtr pScreen, int mode); static void IMSTTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); @@ -158,6 +157,11 @@ static const char *cfbSymbols[] = { }; +static const char *fbSymbols[] = { + "fbScreenInit", + NULL +}; + static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAACreateInfoRec", @@ -189,8 +193,13 @@ static const char *fbdevHWSymbols[] = { #ifdef XFree86LOADER -static pointer IMSTTSetup(pointer module, pointer opts, int *errmaj, + +MODULESETUPPROTO(IMSTTSetup); + +/* +pointer IMSTTSetup(pointer module, pointer opts, int *errmaj, int *errmin); +*/ static XF86ModuleVersionInfo IMSTTVersRec = { "imstt", @@ -205,13 +214,14 @@ static XF86ModuleVersionInfo IMSTTVersRec = { {0, 0, 0, 0} }; -XF86ModuleData IMSTTModuleData = { &IMSTTVersRec, IMSTTSetup, NULL }; +XF86ModuleData imsttModuleData = { &IMSTTVersRec, IMSTTSetup, NULL }; -static pointer IMSTTSetup(pointer module, pointer opts, int *errmaj, +pointer IMSTTSetup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; + IMSTTTRACE("IMSTTSetup -- begin\n"); if (!setupDone) { setupDone = TRUE; xf86AddDriver(&IMSTT, module, 0); @@ -222,6 +232,7 @@ static pointer IMSTTSetup(pointer module, pointer opts, int *errmaj, *errmaj = LDR_ONCEONLY; return NULL; } + IMSTTTRACE("IMSTTSetup -- end\n"); } @@ -271,6 +282,7 @@ static Bool IMSTTProbe(DriverPtr drv, int flags) int numUsed; Bool foundScreen = FALSE; + IMSTTTRACE("IMSTTProbe begin\n"); /* sanity checks */ if ((numDevSections = xf86MatchDevice("imstt", &devSections)) <= 0) return FALSE; @@ -311,6 +323,9 @@ static Bool IMSTTProbe(DriverPtr drv, int flags) NULL, NULL, NULL, NULL, NULL); } + + IMSTTTRACE("IMSTTProbe end\n"); + xfree(usedChips); return foundScreen; } @@ -364,6 +379,9 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->depth == 8) pScrn->rgbBits = 8; + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + pScrn->progClock = TRUE; if (!IMSTTGetRec(pScrn)) @@ -481,15 +499,19 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } + iptr->rev = (INREG(IMSTT_SSTATUS) & 0x0f00) >> 8; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "revision %d\n", iptr->rev); + if (!pScrn->videoRam) { + pScrn->videoRam = iptr->videoRam / 1024; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "probed videoram = %dk\n", - (iptr->videoRam / 1024)); - pScrn->videoRam = (iptr->videoRam / 1024); + pScrn->videoRam); } else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "videoram = %dk\n", - pScrn->videoRam); + pScrn->videoRam / 1024); } /* XXX this is sorta a guess, got some info from the TVP3030 manual */ @@ -537,31 +559,16 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); - 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) { - IMSTTFreeRec(pScrn); + xf86LoadSubModule(pScrn, "fb"); +/* xf86LoaderReqSymbols(fbSymbols, NULL); */ + xf86LoaderReqSymbols("fbScreenInit", NULL); + + if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; - } - xf86LoaderReqSymbols(reqSym, NULL); + xf86LoaderReqSymLists(xaaSymbols, NULL); - if (!iptr->NoAccel) { - if (!xf86LoadSubModule(pScrn, "xaa")) - return FALSE; - } + IMSTTTRACE("PreInit -- END\n"); return TRUE; } @@ -574,19 +581,17 @@ static Bool IMSTTMapMem(ScrnInfoPtr pScrn) iptr = IMSTTPTR(pScrn); - if (iptr->FBDev) { - iptr->MMIOBase = fbdevHWMapMMIO(pScrn); - } else { - iptr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, iptr->PciTag, - iptr->PciInfo->memBase[0] + 0x800000, - 0x1000); - } + iptr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, iptr->PciTag, + iptr->PciInfo->memBase[0] + 0x800000, + 0x41000); if (!iptr->MMIOBase) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not map MMIO\n"); return FALSE; } + IMSTTTRACE("Mapped MMIO @ 0x%x with size 0x1000\n", iptr->PciInfo->memBase[0] + 0x800000); + IMSTTGetVideoMemSize(pScrn); if (iptr->FBDev) { @@ -655,6 +660,11 @@ static void IMSTTGetVideoMemSize(ScrnInfoPtr pScrn) IMSTTMMIO_VARS(); unsigned long tmp; + if (iptr->FBDev) { + iptr->videoRam = fbdevHWGetVidmem(pScrn); + return; + } + tmp = INREG(IMSTT_PRC); if (iptr->ramdac == RAMDAC_IBM) iptr->videoRam = (tmp & 0x0004) ? 0x400000 : 0x200000; @@ -675,86 +685,92 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, VisualPtr visual; int r = TRUE; + IMSTTTRACE("ScreenInit -- Begin\n"); + pScrn = xf86Screens[pScreen->myNum]; - iptr = IMSTTPTR(pScrn); - /* initialize the card */ - tmp = INREG(IMSTT_STGCTL); - OUTREG(IMSTT_STGCTL, tmp & ~0x1); - OUTREG(IMSTT_SSR, 0); + iptr = IMSTTPTR(pScrn); - if (iptr->InitDAC) { - /* set default values for DAC registers */ - if (iptr->ramdac == RAMDAC_IBM) { - iptr->CMAPBase[IBM624_PPMASK] = 0xff; eieio(); - iptr->CMAPBase[IBM624_PIDXHI] = 0; eieio(); - OUTREGPI(IBM624_CLKCTL, 0x21); - OUTREGPI(IBM624_SYNCCTL, 0x00); - OUTREGPI(IBM624_HSYNCPOS, 0x00); - OUTREGPI(IBM624_PWRMNGMT, 0x00); - OUTREGPI(IBM624_DACOP, 0x02); - OUTREGPI(IBM624_PALETCTL, 0x00); - OUTREGPI(IBM624_SYSCLKCTL, 0x01); - OUTREGPI(IBM624_BPP8, 0x00); - OUTREGPI(IBM624_BPP16, 0x01); - OUTREGPI(IBM624_BPP24, 0x00); - OUTREGPI(IBM624_BPP32, 0x00); - OUTREGPI(IBM624_PIXCTL1, 0x05); - OUTREGPI(IBM624_PIXCTL2, 0x00); - OUTREGPI(IBM624_SYSCLKN, 0x08); - OUTREGPI(IBM624_SYSCLKM, 0x4f); - OUTREGPI(IBM624_SYSCLKP, 0x00); - OUTREGPI(IBM624_SYSCLKC, 0x00); - OUTREGPI(IBM624_CURSCTL, 0x00); - OUTREGPI(IBM624_CURSACCTL, 0x01); - OUTREGPI(IBM624_CURSACATTR, 0xa8); - OUTREGPI(IBM624_CURS1R, 0xff); - OUTREGPI(IBM624_CURS1G, 0xff); - OUTREGPI(IBM624_CURS1B, 0xff); - OUTREGPI(IBM624_CURS2R, 0xff); - OUTREGPI(IBM624_CURS2G, 0xff); - OUTREGPI(IBM624_CURS2B, 0xff); - OUTREGPI(IBM624_CURS3R, 0xff); - OUTREGPI(IBM624_CURS3G, 0xff); - OUTREGPI(IBM624_CURS3B, 0xff); - OUTREGPI(IBM624_BORDR, 0xff); - OUTREGPI(IBM624_BORDG, 0xff); - OUTREGPI(IBM624_BORDB, 0xff); - OUTREGPI(IBM624_MISCTL1, 0x01); - OUTREGPI(IBM624_MISCTL2, 0x45); - OUTREGPI(IBM624_MISCTL3, 0x00); - OUTREGPI(IBM624_KEYCTL, 0x00); - } else { - OUTREGPT(TVP_IRICC, 0x00); - OUTREGPT(TVP_IRBRC, 0xe4); - OUTREGPT(TVP_IRLAC, 0x06); - OUTREGPT(TVP_IRTCC, 0x80); - OUTREGPT(TVP_IRMXC, 0x4d); - OUTREGPT(TVP_IRCLS, 0x05); - OUTREGPT(TVP_IRPPG, 0x00); - OUTREGPT(TVP_IRGEC, 0x00); - OUTREGPT(TVP_IRMIC, 0x08); - OUTREGPT(TVP_IRCKL, 0xff); - OUTREGPT(TVP_IRCKH, 0xff); - OUTREGPT(TVP_IRCRL, 0xff); - OUTREGPT(TVP_IRCRH, 0xff); - OUTREGPT(TVP_IRCGL, 0xff); - OUTREGPT(TVP_IRCGH, 0xff); - OUTREGPT(TVP_IRCBL, 0xff); - OUTREGPT(TVP_IRCBH, 0xff); - OUTREGPT(TVP_IRCKC, 0x00); - OUTREGPT(TVP_IRPLA, 0x00); - OUTREGPT(TVP_IRPPD, 0xc0); - OUTREGPT(TVP_IRPPD, 0xd5); - OUTREGPT(TVP_IRPPD, 0xea); - OUTREGPT(TVP_IRPLA, 0x00); - OUTREGPT(TVP_IRMPD, 0xb9); - OUTREGPT(TVP_IRMPD, 0x3a); - OUTREGPT(TVP_IRMPD, 0xb1); - OUTREGPT(TVP_IRPLA, 0x00); - OUTREGPT(TVP_IRLPD, 0xc1); - OUTREGPT(TVP_IRLPD, 0x3d); - OUTREGPT(TVP_IRLPD, 0xf3); + if (!iptr->FBDev) { + /* initialize the card */ + tmp = INREG(IMSTT_STGCTL); + + OUTREG(IMSTT_STGCTL, tmp & ~0x1); + OUTREG(IMSTT_SSR, 0); + + if (iptr->InitDAC) { + /* set default values for DAC registers */ + if (iptr->ramdac == RAMDAC_IBM) { + iptr->CMAPBase[IBM624_PPMASK] = 0xff; eieio(); + iptr->CMAPBase[IBM624_PIDXHI] = 0; eieio(); + OUTREGPI(IBM624_CLKCTL, 0x21); + OUTREGPI(IBM624_SYNCCTL, 0x00); + OUTREGPI(IBM624_HSYNCPOS, 0x00); + OUTREGPI(IBM624_PWRMNGMT, 0x00); + OUTREGPI(IBM624_DACOP, 0x02); + OUTREGPI(IBM624_PALETCTL, 0x00); + OUTREGPI(IBM624_SYSCLKCTL, 0x01); + OUTREGPI(IBM624_BPP8, 0x00); + OUTREGPI(IBM624_BPP16, 0x01); + OUTREGPI(IBM624_BPP24, 0x00); + OUTREGPI(IBM624_BPP32, 0x00); + OUTREGPI(IBM624_PIXCTL1, 0x05); + OUTREGPI(IBM624_PIXCTL2, 0x00); + OUTREGPI(IBM624_SYSCLKN, 0x08); + OUTREGPI(IBM624_SYSCLKM, 0x4f); + OUTREGPI(IBM624_SYSCLKP, 0x00); + OUTREGPI(IBM624_SYSCLKC, 0x00); + OUTREGPI(IBM624_CURSCTL, 0x00); + OUTREGPI(IBM624_CURSACCTL, 0x01); + OUTREGPI(IBM624_CURSACATTR, 0xa8); + OUTREGPI(IBM624_CURS1R, 0xff); + OUTREGPI(IBM624_CURS1G, 0xff); + OUTREGPI(IBM624_CURS1B, 0xff); + OUTREGPI(IBM624_CURS2R, 0xff); + OUTREGPI(IBM624_CURS2G, 0xff); + OUTREGPI(IBM624_CURS2B, 0xff); + OUTREGPI(IBM624_CURS3R, 0xff); + OUTREGPI(IBM624_CURS3G, 0xff); + OUTREGPI(IBM624_CURS3B, 0xff); + OUTREGPI(IBM624_BORDR, 0xff); + OUTREGPI(IBM624_BORDG, 0xff); + OUTREGPI(IBM624_BORDB, 0xff); + OUTREGPI(IBM624_MISCTL1, 0x01); + OUTREGPI(IBM624_MISCTL2, 0x45); + OUTREGPI(IBM624_MISCTL3, 0x00); + OUTREGPI(IBM624_KEYCTL, 0x00); + } else { + OUTREGPT(TVP_IRICC, 0x00); + OUTREGPT(TVP_IRBRC, 0xe4); + OUTREGPT(TVP_IRLAC, 0x06); + OUTREGPT(TVP_IRTCC, 0x80); + OUTREGPT(TVP_IRMXC, 0x4d); + OUTREGPT(TVP_IRCLS, 0x05); + OUTREGPT(TVP_IRPPG, 0x00); + OUTREGPT(TVP_IRGEC, 0x00); + OUTREGPT(TVP_IRMIC, 0x08); + OUTREGPT(TVP_IRCKL, 0xff); + OUTREGPT(TVP_IRCKH, 0xff); + OUTREGPT(TVP_IRCRL, 0xff); + OUTREGPT(TVP_IRCRH, 0xff); + OUTREGPT(TVP_IRCGL, 0xff); + OUTREGPT(TVP_IRCGH, 0xff); + OUTREGPT(TVP_IRCBL, 0xff); + OUTREGPT(TVP_IRCBH, 0xff); + OUTREGPT(TVP_IRCKC, 0x00); + OUTREGPT(TVP_IRPLA, 0x00); + OUTREGPT(TVP_IRPPD, 0xc0); + OUTREGPT(TVP_IRPPD, 0xd5); + OUTREGPT(TVP_IRPPD, 0xea); + OUTREGPT(TVP_IRPLA, 0x00); + OUTREGPT(TVP_IRMPD, 0xb9); + OUTREGPT(TVP_IRMPD, 0x3a); + OUTREGPT(TVP_IRMPD, 0xb1); + OUTREGPT(TVP_IRPLA, 0x00); + OUTREGPT(TVP_IRLPD, 0xc1); + OUTREGPT(TVP_IRLPD, 0x3d); + OUTREGPT(TVP_IRLPD, 0xf3); + } } } @@ -782,28 +798,16 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, switch (pScrn->bitsPerPixel) { case 8: - r = cfbScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 16: - r = cfb16ScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 24: - r = cfb24ScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 32: - r = cfb32ScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, + r = fbScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + pScrn->displayWidth, pScrn->bitsPerPixel); break; default: - r = FALSE; - break; + ErrorF("invalid bpp %d\n", pScrn->bitsPerPixel); + return FALSE; } if (!r) { @@ -853,6 +857,12 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + pScreen->SaveScreen = IMSTTSaveScreen; + pScreen->CloseScreen = IMSTTCloseScreen; + + IMSTTTRACE("ScreenInit -- End\n"); + + return TRUE; } @@ -1290,3 +1300,23 @@ static void IMSTTAdjustFrame(int scrnIndex, int x, int y, int flags) return; } + + +Bool IMSTTCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + IMSTTPtr iptr = IMSTTPTR(pScrn); + + if (iptr->FBDev) + fbdevHWSave(pScrn); + + return TRUE; +} + + +Bool IMSTTSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h index 17fef3279..9c7109c33 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h,v 1.2 2000/06/19 15:01:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h,v 1.4 2000/08/02 21:36:32 dawes Exp $ */ #ifndef _IMSTT_REG_H #define _IMSTT_REG_H @@ -28,13 +28,13 @@ static inline unsigned long regr(unsigned long base_addr, unsigned long regindex } -#define INREG(addr) regr(((unsigned long)IMSTTMMIO), (addr)) -#define OUTREG(addr, val) regw(((unsigned long)IMSTTMMIO), (addr), (val)) +#define INREG(addr) regr(((unsigned long)(iptr->MMIOBase)), (addr)) +#define OUTREG(addr, val) regw(((unsigned long)(iptr->MMIOBase)), (addr), (val)) #else -#define INREG(addr) MMIO_IN32(IMSTTMMIO, addr) -#define OUTREG(addr, val) MMIO_OUT32(IMSTTMMIO, addr, val) +#define INREG(addr) MMIO_IN32(iptr->MMIOBase, addr) +#define OUTREG(addr, val) MMIO_OUT32(iptr->MMIOBase, addr, val) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile index 48a7cca7a..c4576df34 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.33 2000/06/17 00:03:19 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.34 2000/07/08 22:09:09 mvojkovi Exp $ XCOMM XCOMM This is an Imakefile for the MGA driver. XCOMM @@ -24,7 +24,7 @@ OBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \ #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/fb \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(XF86SRC)/int10 \ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index 7fd8f77b5..c0ca3dbe9 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.59 2000/06/17 00:03:19 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.60 2000/07/08 22:09:10 mvojkovi Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -223,6 +223,13 @@ typedef struct { Bool TexturedVideo; MGAPortPrivPtr portPrivate; int numXAALines; + unsigned char *ScratchBuffer; + unsigned char *ColorExpandBase; + int expandRows; + int expandDWORDs; + int expandRemaining; + int expandHeight; + int expandY; #ifdef XF86DRI Bool have_quiescense; Bool directRenderingEnabled; 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 f7fecbf51..1af8ea81e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -43,7 +43,7 @@ * Fixed 32bpp hires 8MB horizontal line glitch at middle right */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.163 2000/06/29 21:03:11 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.165 2000/07/11 01:46:36 tsi Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -79,19 +79,8 @@ #include "xf86RAC.h" #include "vbe.h" - -/* - * If using cfb, cfb.h is required. Select the others for the bpp values - * the driver supports. - */ -#define PSZ 8 /* needed for cfb.h */ -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb24.h" -#include "cfb32.h" -#include "cfb24_32.h" #include "cfb8_32.h" +#include "fb.h" #include "mga_bios.h" #include "mga_reg.h" @@ -262,12 +251,12 @@ static const char *vgahwSymbols[] = { }; static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", "cfb8_32ScreenInit", - "cfb24_32ScreenInit", + NULL +}; + +static const char *fbSymbols[] = { + "fbScreenInit", NULL }; @@ -437,7 +426,7 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin) LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, xf8_32bppSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, shadowSymbols, - fbdevHWSymbols, vbeSymbols, + fbdevHWSymbols, vbeSymbols, fbSymbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif @@ -458,12 +447,6 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin) #endif /* XFree86LOADER */ -/* - * This is intentionally screen-independent. It indicates the binding - * choice made in the first PreInit. - */ -static int pix24bpp = 0; - /* * ramdac info structure initialization */ @@ -1082,8 +1065,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) double real; int bytesPerPixel; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; const char *s; int flags24; @@ -1220,10 +1201,6 @@ MGAPreInit(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. @@ -1240,9 +1217,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } } - if (!xf86SetDefaultVisual(pScrn, -1)) - return FALSE; - bytesPerPixel = pScrn->bitsPerPixel / 8; /* We use a programamble clock */ @@ -1909,44 +1883,21 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } } - /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - reqSym = "cfbScreenInit"; - break; - case 16: - mod = "cfb16"; - reqSym = "cfb16ScreenInit"; - break; - case 24: - if (pix24bpp == 24) { - mod = "cfb24"; - reqSym = "cfb24ScreenInit"; - } else { - mod = "xf24_32bpp"; - reqSym = "cfb24_32ScreenInit"; + /* Load the required framebuffer */ + if(pMga->Overlay8Plus24) { + if (!xf86LoadSubModule(pScrn, "xf8_32bpp")) { + MGAFreeRec(pScrn); + return FALSE; } - break; - case 32: - if (pMga->Overlay8Plus24) { - mod = "xf8_32bpp"; - reqSym = "cfb8_32ScreenInit"; - xf86LoaderReqSymLists(xf8_32bppSymbols, NULL); - } else { - mod = "cfb32"; - reqSym = "cfb32ScreenInit"; - + xf86LoaderReqSymbols("cfb8_32ScreenInit", NULL); + } else { + if (!xf86LoadSubModule(pScrn, "fb")) { + MGAFreeRec(pScrn); + return FALSE; } - break; - } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - MGAFreeRec(pScrn); - return FALSE; + xf86LoaderReqSymbols("fbScreenInit", NULL); } - xf86LoaderReqSymbols(reqSym, NULL); - /* Load XAA if needed */ if (!pMga->NoAccel) { if (!xf86LoadSubModule(pScrn, "xaa")) { @@ -2308,6 +2259,9 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miSetVisualTypes(24, TrueColorMask, pScrn->rgbBits, TrueColor)) return FALSE; } else { + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) @@ -2354,50 +2308,16 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->directRenderingEnabled = FALSE; #endif - - 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 24: - if (pix24bpp == 24) - ret = cfb24ScreenInit(pScreen, FBStart, - width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - else - ret = cfb24_32ScreenInit(pScreen, FBStart, - width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - case 32: - if(pMga->Overlay8Plus24) - ret = cfb8_32ScreenInit(pScreen, FBStart, + + if(pMga->Overlay8Plus24) { + ret = cfb8_32ScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth); - else - ret = cfb32ScreenInit(pScreen, FBStart, - width, height, + } else { + ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - default: - xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in MGAScreenInit\n", - pScrn->bitsPerPixel); - ret = FALSE; - break; + displayWidth, pScrn->bitsPerPixel); } if (!ret) return FALSE; @@ -2703,6 +2623,8 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(pMga->adaptor); if (pMga->portPrivate) xfree(pMga->portPrivate); + if (pMga->ScratchBuffer) + xfree(pMga->ScratchBuffer); pScrn->vtSema = FALSE; 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 61f363de5..17f31f194 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.69 2000/06/29 20:56:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.70 2000/07/08 22:09:11 mvojkovi Exp $ */ /* All drivers should typically include these */ @@ -43,10 +43,16 @@ static void MGANAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, static void MGANAME(SubsequentScreenToScreenCopy_FastBlit)(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); -static void MGANAME(SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg, +static void MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( + ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); -static void MGANAME(SubsequentCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, +static void MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( + ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); +static void MGANAME(SubsequentColorExpandScanline)(ScrnInfoPtr pScrn, + int bufno); +static void MGANAME(SubsequentColorExpandScanlineIndirect)(ScrnInfoPtr pScrn, + int bufno); static void MGANAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y, int w, int h); static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, @@ -69,11 +75,12 @@ static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, int patx, int paty, int y, int h, int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR); -static void MGANAME(SetupForImageWrite)(ScrnInfoPtr pScrn, int rop, +static void MGANAME(SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void MGANAME(SubsequentImageWriteRect)(ScrnInfoPtr pScrn, +static void MGANAME(SubsequentScanlineImageWriteRect)(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); +static void MGANAME(SubsequentImageWriteScanline)(ScrnInfoPtr pScrn, int num); #if PSZ != 24 static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -104,13 +111,6 @@ void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, #endif -extern void MGAWriteBitmapColorExpand(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); -extern void MGAFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); extern void MGASetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2); extern void MGADisableClipping(ScrnInfoPtr pScrn); @@ -123,16 +123,10 @@ extern void MGAFillMono8x8PatternRectsTwoPass(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int nBox, BoxPtr pBox, int pattern0, int pattern1, int xorigin, int yorigin); -extern void MGANonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n, - NonTEGlyphPtr glyphs, BoxPtr pbox, - int fg, int rop, unsigned int planemask); extern void MGAValidatePolyArc(GCPtr, unsigned long, DrawablePtr); extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr); extern void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr, int, int, XAACacheInfoPtr); -extern void MGATEGlyphRenderer(ScrnInfoPtr, int, int, int, int, int, int, - unsigned int **glyphs, int, int, int, int, - unsigned planemask); Bool MGANAME(AccelInit)(ScreenPtr pScreen) @@ -143,6 +137,9 @@ MGANAME(AccelInit)(ScreenPtr pScreen) int maxFastBlitMem, maxlines; BoxRec AvailFBArea; + pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3); + if(!pMga->ScratchBuffer) return FALSE; + pMga->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -166,8 +163,10 @@ MGANAME(AccelInit)(ScreenPtr pScreen) pMga->AccelFlags = TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND; +#if 0 if(pMga->FbMapSize > 8*1024*1024) pMga->AccelFlags |= LARGE_ADDRESSES; +#endif break; case PCI_CHIP_MGA1064: pMga->AccelFlags = 0; @@ -254,28 +253,30 @@ MGANAME(AccelInit)(ScreenPtr pScreen) MGANAME(SubsequentMono8x8PatternFillTrap); /* cpu to screen color expansion */ - infoPtr->CPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | BIT_ORDER_IN_BYTE_LSBFIRST | LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | - SYNC_AFTER_COLOR_EXPAND; + LEFT_EDGE_CLIPPING_NEGATIVE_X; + if(pMga->ILOADBase) { - infoPtr->ColorExpandRange = 0x800000; - infoPtr->ColorExpandBase = pMga->ILOADBase; + pMga->ColorExpandBase = pMga->ILOADBase; } else { - infoPtr->ColorExpandRange = 0x1C00; #ifdef __alpha__ - infoPtr->ColorExpandBase = pMga->IOBaseDense; + pMga->ColorExpandBase = pMga->IOBaseDense; #else - infoPtr->ColorExpandBase = pMga->IOBase; + pMga->ColorExpandBase = pMga->IOBase; #endif } - infoPtr->SetupForCPUToScreenColorExpandFill = - MGANAME(SetupForCPUToScreenColorExpandFill); - infoPtr->SubsequentCPUToScreenColorExpandFill = - MGANAME(SubsequentCPUToScreenColorExpandFill); - + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + MGANAME(SetupForScanlineCPUToScreenColorExpandFill); + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + MGANAME(SubsequentScanlineCPUToScreenColorExpandFill); + infoPtr->SubsequentColorExpandScanline = + MGANAME(SubsequentColorExpandScanline); + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineColorExpandBuffers = &(pMga->ColorExpandBase); /* screen to screen color expansion */ if(pMga->AccelFlags & USE_LINEAR_EXPANSION) { @@ -301,37 +302,24 @@ MGANAME(AccelInit)(ScreenPtr pScreen) } /* image writes */ - infoPtr->ImageWriteFlags = CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | - SYNC_AFTER_IMAGE_WRITE; - - /* if we're write combining */ - infoPtr->ImageWriteFlags |= NO_GXCOPY; - - if(pMga->ILOADBase) { - infoPtr->ImageWriteRange = 0x800000; - infoPtr->ImageWriteBase = pMga->ILOADBase; - } else { - infoPtr->ImageWriteRange = 0x1C00; - infoPtr->ImageWriteBase = pMga->IOBase; - } - infoPtr->SetupForImageWrite = MGANAME(SetupForImageWrite); - infoPtr->SubsequentImageWriteRect = MGANAME(SubsequentImageWriteRect); - + infoPtr->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X | + NO_GXCOPY; + + infoPtr->SetupForScanlineImageWrite = + MGANAME(SetupForScanlineImageWrite); + infoPtr->SubsequentScanlineImageWriteRect = + MGANAME(SubsequentScanlineImageWriteRect); + infoPtr->SubsequentImageWriteScanline = + MGANAME(SubsequentImageWriteScanline); + infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->ScanlineImageWriteBuffers = &(pMga->ScratchBuffer); + /* midrange replacements */ - if(infoPtr->SetupForCPUToScreenColorExpandFill && - infoPtr->SubsequentCPUToScreenColorExpandFill) { - infoPtr->FillColorExpandRects = MGAFillColorExpandRects; - infoPtr->WriteBitmap = MGAWriteBitmapColorExpand; - infoPtr->TEGlyphRenderer = MGATEGlyphRenderer; - if(BITMAP_SCANLINE_PAD == 32) - infoPtr->NonTEGlyphRenderer = MGANonTEGlyphRenderer; - } - if(pMga->ILOADBase && pMga->UsePCIRetry && infoPtr->SetupForSolidFill) { infoPtr->FillSolidRects = MGAFillSolidRectsDMA; infoPtr->FillSolidSpans = MGAFillSolidSpansDMA; @@ -355,18 +343,14 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->ImageWriteFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK; infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; - infoPtr->WriteBitmapFlags |= NO_PLANEMASK; infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->SolidLineFlags |= NO_PLANEMASK; infoPtr->DashedLineFlags |= NO_PLANEMASK; infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; - infoPtr->FillColorExpandRectsFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->FillSolidRectsFlags |= NO_PLANEMASK; infoPtr->FillSolidSpansFlags |= NO_PLANEMASK; infoPtr->FillMono8x8PatternRectsFlags |= NO_PLANEMASK; - infoPtr->NonTEGlyphRendererFlags |= NO_PLANEMASK; - infoPtr->TEGlyphRendererFlags |= NO_PLANEMASK; infoPtr->FillCacheBltRectsFlags |= NO_PLANEMASK; } @@ -1013,7 +997,7 @@ MGANAME(SubsequentMono8x8PatternFillTrap)( static void -MGANAME(SetupForCPUToScreenColorExpandFill)( +MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -1054,7 +1038,7 @@ MGANAME(SetupForCPUToScreenColorExpandFill)( } static void -MGANAME(SubsequentCPUToScreenColorExpandFill)( +MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft @@ -1062,21 +1046,107 @@ MGANAME(SubsequentCPUToScreenColorExpandFill)( MGAPtr pMga = MGAPTR(pScrn); pMga->AccelFlags |= CLIPPER_ON; + pMga->expandDWORDs = (w + 31) >> 5; + if((pMga->expandDWORDs * h) > pMga->MaxBlitDWORDS) { + pMga->expandHeight = pMga->MaxBlitDWORDS / pMga->expandDWORDs; + pMga->expandRemaining = h / pMga->expandHeight; + if(!(h = h % pMga->expandHeight)) { + pMga->expandRemaining--; + h = pMga->expandHeight; + } + pMga->expandY = y + h; + } else + pMga->expandRemaining = 0; + pMga->expandRows = h; + WAITFIFO(5); OUTREG(MGAREG_CXBNDRY, ((x + w - 1) << 16) | ((x + skipleft) & 0xFFFF)); - w = (w + 31) & ~31; /* source is dword padded */ + w = pMga->expandDWORDs << 5; /* source is dword padded */ OUTREG(MGAREG_AR0, (w * h) - 1); OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */ OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); + + if(pMga->expandDWORDs > pMga->FifoSize) { + pMga->AccelInfoRec->SubsequentColorExpandScanline = + MGANAME(SubsequentColorExpandScanlineIndirect); + pMga->AccelInfoRec->ScanlineColorExpandBuffers = + (unsigned char**)(&pMga->ScratchBuffer); + } else { + pMga->AccelInfoRec->SubsequentColorExpandScanline = + MGANAME(SubsequentColorExpandScanline); + pMga->AccelInfoRec->ScanlineColorExpandBuffers = + (unsigned char**)(&pMga->ColorExpandBase); + WAITFIFO(pMga->expandDWORDs); + } +} + +static void +MGANAME(SubsequentColorExpandScanlineIndirect)( + ScrnInfoPtr pScrn, + int bufno +){ + MGAPtr pMga = MGAPTR(pScrn); + int dwords = pMga->expandDWORDs; + CARD32 *src = (CARD32*)(pMga->ScratchBuffer); + + while(dwords > pMga->FifoSize) { + WAITFIFO(pMga->FifoSize); + XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + src += pMga->FifoSize; + dwords -= pMga->FifoSize; + } + + WAITFIFO(dwords); + XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + + if(!(--pMga->expandRows)) { + if(pMga->expandRemaining) { + WAITFIFO(3); + OUTREG(MGAREG_AR0,((pMga->expandDWORDs<< 5)*pMga->expandHeight)-1); + OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */ + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | + pMga->expandHeight); + pMga->expandY += pMga->expandHeight; + pMga->expandRows = pMga->expandHeight; + pMga->expandRemaining--; + } else { + DISABLE_CLIP(); + } + } } +static void +MGANAME(SubsequentColorExpandScanline)( + ScrnInfoPtr pScrn, + int bufno +){ + MGAPtr pMga = MGAPTR(pScrn); + + if(--pMga->expandRows) { + WAITFIFO(pMga->expandDWORDs); + } else if(pMga->expandRemaining) { + WAITFIFO(3); + OUTREG(MGAREG_AR0,((pMga->expandDWORDs<<5)*pMga->expandHeight)-1); + OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */ + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | + pMga->expandHeight); + pMga->expandY += pMga->expandHeight; + pMga->expandRows = pMga->expandHeight; + pMga->expandRemaining--; + WAITFIFO(pMga->expandDWORDs); + } else { + DISABLE_CLIP(); + } +} + + /*******************\ | Image Writes | \*******************/ -static void MGANAME(SetupForImageWrite)( +static void MGANAME(SetupForScanlineImageWrite)( ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -1095,7 +1165,7 @@ static void MGANAME(SetupForImageWrite)( } -static void MGANAME(SubsequentImageWriteRect)( +static void MGANAME(SubsequentScanlineImageWriteRect)( ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft @@ -1103,6 +1173,8 @@ static void MGANAME(SubsequentImageWriteRect)( MGAPtr pMga = MGAPTR(pScrn); pMga->AccelFlags |= CLIPPER_ON; + pMga->expandRows = h; + pMga->expandDWORDs = ((w * PSZ) + 31) >> 5; WAITFIFO(5); OUTREG(MGAREG_CXBNDRY, 0xFFFF0000 | ((x + skipleft) & 0xFFFF)); @@ -1112,6 +1184,29 @@ static void MGANAME(SubsequentImageWriteRect)( OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); } +static void MGANAME(SubsequentImageWriteScanline)( + ScrnInfoPtr pScrn, + int bufno +){ + MGAPtr pMga = MGAPTR(pScrn); + int dwords = pMga->expandDWORDs; + CARD32 *src = (CARD32*)(pMga->ScratchBuffer); + + while(dwords > pMga->FifoSize) { + WAITFIFO(pMga->FifoSize); + XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + src += pMga->FifoSize; + dwords -= pMga->FifoSize; + } + + WAITFIFO(dwords); + XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + + if(!(--pMga->expandRows)) { + DISABLE_CLIP(); + } +} + /***************************\ | Dashed Lines | @@ -1410,183 +1505,6 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( #if PSZ == 8 - -static __inline__ CARD32* MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords -) -{ - while(dwords & ~0x03) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - src += 4; - dest += 4; - dwords -= 4; - } - - if(!dwords) return(dest); - dest[0] = src[0]; - if(dwords == 1) return(dest+1); - dest[1] = src[1]; - if(dwords == 2) return(dest+2); - dest[2] = src[2]; - return(dest+3); -} - -void -MGAWriteBitmapColorExpand( - 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 -) -{ - MGAPtr pMga = MGAPTR(pScrn); - XAAInfoRecPtr infoRec = pMga->AccelInfoRec; - CARD32* destptr = (CARD32*)infoRec->ColorExpandBase; - CARD32* maxptr; - int dwords, maxlines, count; - - CHECK_DMA_QUIESCENT(pMga, pScrn); - - (*infoRec->SetupForCPUToScreenColorExpandFill)( - pScrn, fg, bg, rop, planemask); - - w += skipleft; - x -= skipleft; - dwords = (w + 31) >> 5; - maxlines = pMga->MaxBlitDWORDS / dwords; - maxptr = destptr + infoRec->ColorExpandRange - dwords; - - while(h > maxlines) { - (*infoRec->SubsequentCPUToScreenColorExpandFill) - (pScrn, x, y, w, maxlines, skipleft); - count = maxlines; - while(count--) { - WAITFIFO(dwords); - destptr = MoveDWORDS(destptr, (CARD32*)src, dwords); - src += srcwidth; - if(destptr > maxptr) - destptr = (CARD32*)infoRec->ColorExpandBase; - } - h -= maxlines; - y += maxlines; - } - - (*infoRec->SubsequentCPUToScreenColorExpandFill)( - pScrn, x, y, w, h, skipleft); - - while(h--) { - WAITFIFO(dwords); - destptr = MoveDWORDS(destptr, (CARD32*)src, dwords); - src += srcwidth; - if(destptr > maxptr) - destptr = (CARD32*)infoRec->ColorExpandBase; - } - DISABLE_CLIP(); - SET_SYNC_FLAG(infoRec); -} - - -void -MGAFillColorExpandRects( - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, - PixmapPtr pPix -){ - MGAPtr pMga = MGAPTR(pScrn); - XAAInfoRecPtr infoRec = pMga->AccelInfoRec; - CARD32 *destptr, *maxptr; - StippleScanlineProcPtr StippleFunc; - unsigned char *src = (unsigned char*)pPix->devPrivate.ptr; - int stipplewidth = pPix->drawable.width; - int stippleheight = pPix->drawable.height; - int srcwidth = pPix->devKind; - int dwords, h, y, maxlines, count, srcx, srcy; - unsigned char *srcp; - - if(stipplewidth <= 32) { - if(stipplewidth & (stipplewidth - 1)) - StippleFunc = XAAStippleScanlineFuncLSBFirst[1]; - else - StippleFunc = XAAStippleScanlineFuncLSBFirst[0]; - } else - StippleFunc = XAAStippleScanlineFuncLSBFirst[2]; - - (*infoRec->SetupForCPUToScreenColorExpandFill)( - pScrn, fg, bg, rop, planemask); - - while(nBox--) { - dwords = (pBox->x2 - pBox->x1 + 31) >> 5; - destptr = (CARD32*)infoRec->ColorExpandBase; - maxptr = destptr + infoRec->ColorExpandRange - dwords; - maxlines = pMga->MaxBlitDWORDS / dwords; - y = pBox->y1; - h = pBox->y2 - y; - - srcy = (pBox->y1 - yorg) % stippleheight; - if(srcy < 0) srcy += stippleheight; - srcx = (pBox->x1 - xorg) % stipplewidth; - if(srcx < 0) srcx += stipplewidth; - - srcp = (srcwidth * srcy) + src; - - while(h > maxlines) { - (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, - pBox->x1, y, pBox->x2 - pBox->x1, maxlines, 0); - count = maxlines; - while(count--) { - WAITFIFO(dwords); - destptr = (*StippleFunc)( - destptr, (CARD32*)srcp, srcx, stipplewidth, dwords); - if(destptr > maxptr) - destptr = (CARD32*)infoRec->ColorExpandBase; - srcy++; - srcp += srcwidth; - if (srcy >= stippleheight) { - srcy = 0; - srcp = src; - } - } - h -= maxlines; - y += maxlines; - } - - (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, - pBox->x1, y , pBox->x2 - pBox->x1, h, 0); - - while(h--) { - WAITFIFO(dwords); - destptr = (*StippleFunc)( - destptr, (CARD32*)srcp, srcx, stipplewidth, dwords); - if(destptr > maxptr) - destptr = (CARD32*)infoRec->ColorExpandBase; - srcy++; - srcp += srcwidth; - if (srcy >= stippleheight) { - srcy = 0; - srcp = src; - } - } - - pBox++; - } - DISABLE_CLIP(); - SET_SYNC_FLAG(infoRec); -} - - void MGAFillSolidRectsDMA( ScrnInfoPtr pScrn, @@ -1739,76 +1657,6 @@ SECOND_PASS: SET_SYNC_FLAG(infoRec); } -void MGANonTEGlyphRenderer( - ScrnInfoPtr pScrn, - int x, int y, int n, - NonTEGlyphPtr glyphs, - BoxPtr pbox, - int fg, int rop, - unsigned int planemask -){ - MGAPtr pMga = MGAPTR(pScrn); - XAAInfoRecPtr infoRec = pMga->AccelInfoRec; - int x1, x2, y1, y2, i, h, skiptop, dwords, maxlines; - unsigned char *src; - - CHECK_DMA_QUIESCENT(pMga, pScrn); - (*infoRec->SetupForCPUToScreenColorExpandFill)( - pScrn, fg, -1, rop, planemask); - WAITFIFO(1); - OUTREG(MGAREG_CXBNDRY, ((pbox->x2 - 1) << 16) | pbox->x1); - pMga->AccelFlags |= CLIPPER_ON; - - for(i = 0; i < n; i++, glyphs++) { - if(!glyphs->srcwidth) continue; - - y1 = y - glyphs->yoff; - y2 = y1 + glyphs->height; - if(y1 < pbox->y1) { - skiptop = pbox->y1 - y1; - y1 = pbox->y1; - } else skiptop = 0; - if(y2 > pbox->y2) y2 = pbox->y2; - - h = y2 - y1; - if(h <= 0) continue; - - src = glyphs->bits + (skiptop * glyphs->srcwidth); - - dwords = glyphs->srcwidth >> 2; /* dwords per line */ - x1 = x + glyphs->start; - x2 = x1 + (dwords << 5); - - maxlines = min(pMga->MaxBlitDWORDS, infoRec->ColorExpandRange); - maxlines /= dwords; - - while(h > maxlines) { - WAITFIFO(4); - OUTREG(MGAREG_AR0, (dwords * maxlines << 5) - 1); - OUTREG(MGAREG_AR3, 0); - OUTREG(MGAREG_FXBNDRY, ((x2 - 1) << 16) | (x1 & 0xFFFF)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y1 << 16) | h); - WAITFIFO(dwords * maxlines); - MoveDWORDS((CARD32*)infoRec->ColorExpandBase, - (CARD32*)src, dwords * maxlines); - src += dwords * maxlines << 2; - h -= maxlines; - y1 += maxlines; - } - - dwords *= h; /* total dwords */ - WAITFIFO(4); - OUTREG(MGAREG_AR0, (dwords << 5) - 1); - OUTREG(MGAREG_AR3, 0); - OUTREG(MGAREG_FXBNDRY, ((x2 - 1) << 16) | (x1 & 0xFFFF)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y1 << 16) | h); - WAITFIFO(dwords); - MoveDWORDS((CARD32*)infoRec->ColorExpandBase, (CARD32*)src, dwords); - } - - DISABLE_CLIP(); - SET_SYNC_FLAG(infoRec); -} void MGAValidatePolyArc( @@ -1818,15 +1666,20 @@ MGAValidatePolyArc( ){ ScrnInfoPtr pScrn = xf86Screens[pGC->pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); + Bool fullPlanemask = TRUE; - if((pMga->AccelFlags & MGA_NO_PLANEMASK) && (pGC->planemask != ~0)) - return; + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + pMga->AccelInfoRec->FullPlanemask) + { + if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; + fullPlanemask = FALSE; + } if(!pGC->lineWidth && (pGC->fillStyle == FillSolid) && (pGC->lineStyle == LineSolid) && - ((pGC->alu != GXcopy) || (pGC->planemask != ~0) || - (pScrn->bitsPerPixel == 24))) { + ((pGC->alu != GXcopy) || !fullPlanemask)) + { pGC->ops->PolyArc = MGAPolyArcThinSolid; } } @@ -1898,14 +1751,18 @@ MGAValidatePolyPoint( ){ ScrnInfoPtr pScrn = xf86Screens[pGC->pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); + Bool fullPlanemask = TRUE; pGC->ops->PolyPoint = XAAFallbackOps.PolyPoint; - if((pMga->AccelFlags & MGA_NO_PLANEMASK) && (pGC->planemask != ~0)) - return; + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + pMga->AccelInfoRec->FullPlanemask) + { + if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; + fullPlanemask = FALSE; + } - if((pGC->alu != GXcopy) || (pGC->planemask != ~0) || - (pScrn->bitsPerPixel == 24)) + if((pGC->alu != GXcopy) || !fullPlanemask) pGC->ops->PolyPoint = MGAPolyPoint; } @@ -2003,49 +1860,6 @@ MGAFillCacheBltRects( SET_SYNC_FLAG(infoRec); } -void -MGATEGlyphRenderer( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, int startline, - unsigned int **glyphs, int glyphWidth, - int fg, int bg, int rop, unsigned planemask -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GlyphScanlineFuncPtr GlyphFunc = - XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1]; - MGAPtr pMga = MGAPTR(pScrn); - CARD32* base; - int dwords; - - CHECK_DMA_QUIESCENT(pMga, pScrn); - - (*infoRec->SetupForCPUToScreenColorExpandFill)( - pScrn, fg, bg, rop, planemask); - - w += skipleft; - x -= skipleft; - dwords = (w + 31) >> 5; - - (*infoRec->SubsequentCPUToScreenColorExpandFill)( - pScrn, x, y, w, h, skipleft); - - base = (CARD32*)infoRec->ColorExpandBase; - - if((dwords * h) <= infoRec->ColorExpandRange) - while(h--) { - WAITFIFO(dwords); - base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth); - } - else - while(h--) { - WAITFIFO(dwords); - (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth); - } - - DISABLE_CLIP(); - SET_SYNC_FLAG(infoRec); -} - #endif #ifdef XF86DRI diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h index bbf48a6be..a29dc6eed 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h @@ -22,7 +22,7 @@ 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. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.11 2000/06/30 17:15:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.12 2000/08/04 16:13:31 eich Exp $ */ /* * The original Precision Insight driver for @@ -217,7 +217,7 @@ typedef struct neoRec Bool onPciBurst; Bool progLcdRegs; Bool progLcdStretch; - Bool progLcdStrechOpt; + Bool progLcdStretchOpt; Bool overrideValidate; /* registers */ NeoRegRec NeoModeReg; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c index 35cca1172..456b44001 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c @@ -22,7 +22,7 @@ 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. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.6 2000/06/16 01:50:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.7 2000/08/04 16:13:31 eich Exp $ */ /* * The original Precision Insight driver for @@ -58,6 +58,9 @@ static void Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, static void Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); +static void Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, int srcX, + int srcY, int dstX, int dstY, + int w, int h); static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, @@ -134,8 +137,8 @@ Neo2200AccelInit(ScreenPtr pScreen) infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK); infoPtr->SetupForScreenToScreenCopy = Neo2200SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - Neo2200SubsequentScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy + = Neo2200SubsequentScreenToScreenCopyBroken; /* solid filled rectangles */ infoPtr->SolidFillFlags = NO_PLANEMASK; @@ -259,7 +262,7 @@ Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, NEOACLPtr nAcl = NEOACLPTR(pScrn); nAcl->tmpBltCntlFlags = (NEO_BC3_SKIP_MAPPING | neo2200Rop[rop]); - + /* set blt control */ WAIT_ENGINE_IDLE(); /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ @@ -305,6 +308,96 @@ Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, } } +static void +Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, + int srcX, int srcY, + int dstX, int dstY, + int w, int h) +{ + NEOPtr nPtr = NEOPTR(pScrn); + NEOACLPtr nAcl = NEOACLPTR(pScrn); + + if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { + if (((dstX < 64) && ((srcX + w) == pScrn->displayWidth)) || + ((dstX == 0) && (w > (pScrn->displayWidth - 64)))) { + + int srcX1 = srcX + 64; + int dstX1 = dstX + 64; + w -= 64; + /* start with upper left corner */ + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); + OUTREG(NEOREG_SRCSTARTOFF, + (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (64)); + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_SRCSTARTOFF, + (srcY * nAcl->Pitch) + (srcX1 * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + (dstY * nAcl->Pitch) + (dstX1 * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + } else { + /* start with upper left corner */ + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); + OUTREG(NEOREG_SRCSTARTOFF, + (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + } + } else { + if ((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0)) + || (((dstX + w) == pScrn->displayWidth) + && (w > (pScrn->displayWidth - 64)))) { + int srcX1, dstX1; + + w -= 64; + srcX1 = srcX + w; + dstX1 = dstX + w; + /* start with lower right corner */ +#if 1 + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags + | NEO_BC0_X_DEC + | NEO_BC0_DST_Y_DEC + | NEO_BC0_SRC_Y_DEC)); + OUTREG(NEOREG_SRCSTARTOFF, + ((srcY+h-1) * nAcl->Pitch) + ((srcX1+64-1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + ((dstY+h-1) * nAcl->Pitch) + ((dstX1+64-1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (64 & 0xffff)); +#endif + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_SRCSTARTOFF, + ((srcY+h-1) * nAcl->Pitch) + ((srcX + w -1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + ((dstY+h-1) * nAcl->Pitch) + ((dstX + w -1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + } else { + /* start with lower right corner */ + WAIT_ENGINE_IDLE(); + OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags + | NEO_BC0_X_DEC + | NEO_BC0_DST_Y_DEC + | NEO_BC0_SRC_Y_DEC)); + OUTREG(NEOREG_SRCSTARTOFF, + ((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_DSTSTARTOFF, + ((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1) + * nAcl->PixelWidth)); + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + } + } +} + static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c index bb653806b..df3075625 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c @@ -22,7 +22,7 @@ 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. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c,v 1.4 2000/02/08 13:13:18 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c,v 1.5 2000/08/04 16:13:32 eich Exp $ */ /* * The original Precision Insight driver for @@ -269,11 +269,11 @@ neoUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { NEOACLPtr nAcl = NEOACLPTR(xf86Screens[pScr->myNum]); NEOPtr nPtr = NEOPTR(xf86Screens[pScr->myNum]); - + if(!nPtr->noLinear) { return(nAcl->UseHWCursor); } - + return (FALSE); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c index f20fc3aa1..06476b05c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c @@ -22,7 +22,7 @@ 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. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.29 2000/06/30 17:15:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.30 2000/08/04 16:13:32 eich Exp $ */ /* * The original Precision Insight driver for @@ -903,7 +903,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags) OPTION_PROG_LCD_MODE_REGS,&nPtr->progLcdRegs); if (xf86GetOptValBool(nPtr->Options, OPTION_PROG_LCD_MODE_STRETCH,&nPtr->progLcdStretch)) - nPtr->progLcdStrechOpt = TRUE; + nPtr->progLcdStretchOpt = TRUE; xf86GetOptValBool(nPtr->Options, OPTION_OVERRIDE_VALIDATE_MODE, &nPtr->overrideValidate); nPtr->rotate = 0; @@ -957,7 +957,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags) "Internal LCD only display mode\n"); } } - + if (nPtr->noLcdStretch) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Low resolution video modes are not stretched\n"); @@ -1526,9 +1526,9 @@ NEOScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) "Hardware cursor initialization failed\n"); return FALSE; } - nAcl->UseHWCursor = TRUE; nPtr->NeoHWCursorInitialized = TRUE; - } + } else + nAcl->UseHWCursor = FALSE; } if (nPtr->shadowFB) { @@ -1940,7 +1940,7 @@ neoProgramShadowRegs(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore) if (restore->PanelDispCntlReg2 & 0x84) { /* Don't program by default if in stretch mode */ noProgramShadowRegs = TRUE; - if (nPtr->progLcdStretch) + if (nPtr->progLcdStretch) noProgramShadowRegs = FALSE; } break; @@ -1959,7 +1959,7 @@ neoProgramShadowRegs(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore) if (restore->PanelDispCntlReg2 & 0x84) { /* Only change the behavior if an option is set */ - if (nPtr->progLcdStrechOpt) + if (nPtr->progLcdStretchOpt) noProgramShadowRegs = !nPtr->progLcdStretch; } break; @@ -2088,7 +2088,7 @@ neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore, int i; vgaHWProtect(pScrn,TRUE); /* Blank the screen */ - + VGAwGR(0x09,0x26); /* Init the shadow registers if necessary */ @@ -2136,7 +2136,7 @@ neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore, * Sleep for 200ms to make sure that the two operations above have * had time to take effect. */ - usleep(200000); + xf86UDelay(200000); /* * This function handles restoring the generic VGA registers. */ @@ -2271,6 +2271,7 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) * This will allocate the datastructure and initialize all of the * generic VGA registers. */ + if (!vgaHWInit(pScrn, mode)) return(FALSE); @@ -2361,6 +2362,7 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (nPtr->externDisp) { NeoNew->PanelDispCntlReg1 |= 0x01; } + #if 0 /* * This was replaced: if no devices are specified take the @@ -2412,6 +2414,8 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) */ NeoNew->PanelDispCntlReg2 = 0x00; NeoNew->PanelDispCntlReg3 = 0x00; + nAcl->UseHWCursor = TRUE; + if ((!nPtr->noLcdStretch) && (NeoNew->PanelDispCntlReg1 & 0x02)) { if (mode->HDisplay == nPtr->NeoPanelWidth) { @@ -2419,8 +2423,10 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) * No stretching required when the requested display width * equals the panel width. */ - if (nPtr->NeoHWCursorInitialized) nAcl->UseHWCursor = TRUE; + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Stretching disabled\n"); + nPtr->noLcdStretch = TRUE; } else { + switch (mode->HDisplay) { case 320 : /* Needs testing. KEM -- 24 May 98 */ case 400 : /* Needs testing. KEM -- 24 May 98 */ @@ -2428,18 +2434,18 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case 800 : case 1024 : NeoNew->PanelDispCntlReg2 |= 0xC6; - if (nPtr->NeoHWCursorInitialized) nAcl->UseHWCursor = FALSE; + nAcl->UseHWCursor = FALSE; break; default : /* No stretching in these modes. */ - if (nPtr->NeoHWCursorInitialized) nAcl->UseHWCursor = TRUE; + xf86DrvMsg(pScrn->scrnIndex,X_INFO, + "Stretching disabled not supported in this mode\n"); + nPtr->noLcdStretch = TRUE; break; } } } else if (mode->Flags & V_DBLSCAN) { - if (nPtr->NeoHWCursorInitialized) nAcl->UseHWCursor = FALSE; - } else { - if (nPtr->NeoHWCursorInitialized) nAcl->UseHWCursor = TRUE; + nAcl->UseHWCursor = FALSE; } /* diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c index e6b0f1787..196df4700 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c @@ -24,7 +24,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.44 2000/06/21 17:28:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.45 2000/08/11 05:04:08 mvojkovi Exp $ */ #include "nv_include.h" @@ -99,6 +99,13 @@ static SymTabRec NVChipsets[] = { { NV_CHIP_GEFORCE256, "GeForce 256" }, { NV_CHIP_GEFORCEDDR, "GeForce DDR" }, { NV_CHIP_QUADRO, "Quadro" }, + { NV_CHIP_GEFORCE2GTS, "GeForce2 GTS"}, + { NV_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)"}, + { NV_CHIP_GEFORCE2GTS_2,"GeForce2 GTS (rev 2)"}, + { NV_CHIP_QUADRO2PRO, "Quadro 2 Pro"}, + { NV_CHIP_GEFORCE2MX, "GeForce2 MX"}, + { NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX DDR"}, + { NV_CHIP_QUADRO2MXR, "Quadro 2 MXR"}, {-1, NULL } }; @@ -113,7 +120,14 @@ static PciChipsets NVPciChipsets[] = { { NV_CHIP_GEFORCE256, NV_CHIP_GEFORCE256, RES_SHARED_VGA }, { NV_CHIP_GEFORCEDDR, NV_CHIP_GEFORCEDDR, RES_SHARED_VGA }, { NV_CHIP_QUADRO, NV_CHIP_QUADRO, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } + { NV_CHIP_GEFORCE2GTS, NV_CHIP_GEFORCE2GTS, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE2GTS_1, NV_CHIP_GEFORCE2GTS_1, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE2GTS_2, NV_CHIP_GEFORCE2GTS_2, RES_SHARED_VGA }, + { NV_CHIP_QUADRO2PRO, NV_CHIP_QUADRO2PRO, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE2MX, NV_CHIP_GEFORCE2MX, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE2MXDDR, NV_CHIP_GEFORCE2MXDDR, RES_SHARED_VGA }, + { NV_CHIP_QUADRO2MXR, NV_CHIP_QUADRO2MXR, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } }; /* @@ -1056,6 +1070,13 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) case NV_CHIP_GEFORCE256: case NV_CHIP_GEFORCEDDR: case NV_CHIP_QUADRO: + case NV_CHIP_GEFORCE2GTS: + case NV_CHIP_GEFORCE2GTS_1: + case NV_CHIP_GEFORCE2GTS_2: + case NV_CHIP_QUADRO2PRO: + case NV_CHIP_GEFORCE2MX: + case NV_CHIP_GEFORCE2MXDDR: + case NV_CHIP_QUADRO2MXR: NV10Setup(pScrn); break; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h index 12cb6e93c..08332f02f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.2 2000/02/09 17:10:26 dawes Exp */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.5 2000/08/03 12:24:03 dawes Exp $ */ #ifndef __NV_LOCAL_H__ #define __NV_LOCAL_H__ @@ -45,6 +45,7 @@ * Put all affected includes, typdefs, etc. here so the riva_hw.* files can stay * generic in nature. */ +#include "xf86_ansic.h" #include "compiler.h" /* * Typedefs to force certain sized values. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h index 5b249bb4f..f71d3aad0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.12 2000/03/13 18:49:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.13 2000/08/11 05:04:08 mvojkovi Exp $ */ #ifndef __NV_STRUCT_H__ #define __NV_STRUCT_H__ @@ -131,5 +131,12 @@ void NVPointerMoved(int index, int x, int y); #define NV_CHIP_GEFORCE256 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_GEFORCE256) #define NV_CHIP_GEFORCEDDR ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_GEFORCEDDR) #define NV_CHIP_QUADRO ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_QUADRO) +#define NV_CHIP_GEFORCE2MX ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MX) +#define NV_CHIP_GEFORCE2MXDDR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MXDDR) +#define NV_CHIP_QUADRO2MXR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2MXR) +#define NV_CHIP_GEFORCE2GTS ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS) +#define NV_CHIP_GEFORCE2GTS_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS_1) +#define NV_CHIP_GEFORCE2GTS_2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS_2) +#define NV_CHIP_QUADRO2PRO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2PRO) #endif /* __NV_STRUCT_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c index 9ff7db70f..c1f54b028 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c @@ -41,7 +41,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.14 2000/02/25 21:02:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.16 2000/08/11 06:14:10 mvojkovi Exp $ */ #include "nv_include.h" #include "xaalocal.h" @@ -52,6 +52,8 @@ #include "miline.h" +#define DOLINES + /* * Macro to define valid rectangle. */ @@ -70,6 +72,12 @@ NVSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2) } +static void +NVDisableClipping(ScrnInfoPtr pScrn) +{ + NVSetClippingRectangle(pScrn, 0, 0, 0x7fff, 0x7fff); +} + /* * Set pattern. Internal routine. The upper bits of the colors * are the ALPHA bits. 0 == transparency. @@ -442,9 +450,7 @@ NVSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) } -#if 0 - -/* Broken at the moment */ +#ifdef DOLINES static void NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) @@ -453,7 +459,7 @@ NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) NVSetRopSolid(pNv, rop); RIVA_FIFO_FREE(pNv->riva, Line, 1); - pNv->riva.Line->Color = color; + pNv->FgColor = color; } static void @@ -461,12 +467,13 @@ NVSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir) { NVPtr pNv = NVPTR(pScrn); - RIVA_FIFO_FREE(pNv->riva, Line, 2); - pNv->riva.Line->Lin[0].point0 = (y << 16) | ( x & 0xffff); + RIVA_FIFO_FREE(pNv->riva, Line, 3); + pNv->riva.Line->Color = pNv->FgColor; + pNv->riva.Line->Lin[0].point0 = ((y << 16) | ( x & 0xffff)); if ( dir ==DEGREES_0 ) - pNv->riva.Line->Lin[0].point1 = (y << 16) | (( x + len ) & 0xffff); + pNv->riva.Line->Lin[0].point1 = ((y << 16) | (( x + len ) & 0xffff)); else - pNv->riva.Line->Lin[0].point1 = ((y + len) << 16) | ( x & 0xffff); + pNv->riva.Line->Lin[0].point1 = (((y + len) << 16) | ( x & 0xffff)); } static void @@ -474,17 +481,16 @@ NVSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) { NVPtr pNv = NVPTR(pScrn); + Bool lastPoint = !(flags & OMIT_LAST); - RIVA_FIFO_FREE(pNv->riva, Line, 2); - if ( flags & OMIT_LAST ) - { - pNv->riva.Line->Lin[0].point1 = (y1 << 16) | ( x1 & 0xffff); - pNv->riva.Line->PolyLin[0] = (y2 << 16) | ( x2 & 0xffff); - } - else + RIVA_FIFO_FREE(pNv->riva, Line, lastPoint ? 5 : 3); + pNv->riva.Line->Color = pNv->FgColor; + pNv->riva.Line->Lin[0].point0 = ((y1 << 16) | (x1 & 0xffff)); + pNv->riva.Line->Lin[0].point1 = ((y2 << 16) | (x2 & 0xffff)); + if (lastPoint) { - pNv->riva.Line->Lin[0].point0 = (y1 << 16) | ( x1 & 0xffff); - pNv->riva.Line->Lin[0].point1 = (y2 << 16) | ( x2 & 0xffff); + pNv->riva.Line->Lin[1].point0 = ((y2 << 16) | (x2 & 0xffff)); + pNv->riva.Line->Lin[1].point1 = (((y2 + 1) << 16) | (x2 & 0xffff)); } } @@ -720,19 +726,22 @@ NVAccelInit(ScreenPtr pScreen) infoPtr->ScanlineImageWriteBuffers = &pNv->expandBuffer; } -#if 0 - /* Solid lines, don't work yet */ +#ifdef DOLINES infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->PolySegmentThinSolidFlags = NO_PLANEMASK; - infoPtr->PolylinesThinSolidFlags = NO_PLANEMASK; infoPtr->SetupForSolidLine = NVSetupForSolidLine; infoPtr->SubsequentSolidHorVertLine = NVSubsequentSolidHorVertLine; infoPtr->SubsequentSolidTwoPointLine = NVSubsequentSolidTwoPointLine; + infoPtr->SetClippingRectangle = NVSetClippingRectangle; + infoPtr->DisableClipping = NVDisableClipping; + infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE; + miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6); #else infoPtr->SolidLineFlags = NO_PLANEMASK; infoPtr->SetupForSolidLine = NVSetupForSolidLine; + infoPtr->PolySegmentThinSolidFlags = NO_PLANEMASK; + infoPtr->PolylinesThinSolidFlags = NO_PLANEMASK; infoPtr->SubsequentSolidHorVertLine = NVSubsequentSolidHorVertLine; infoPtr->SubsequentSolidBresenhamLine = @@ -747,8 +756,8 @@ NVAccelInit(ScreenPtr pScreen) infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask; infoPtr->ValidatePolyPoint = NVValidatePolyPoint; infoPtr->PolyPointMask = GCFunction | GCPlaneMask; - - NVSetClippingRectangle(pScrn, 0, 0, 0x7fff, 0x7fff); + + NVDisableClipping(pScrn); return(XAAInit(pScreen, infoPtr)); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h index fce7568fb..8bd563fcf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h @@ -36,7 +36,10 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.5 2000/02/08 17:19:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.6 2000/08/11 05:04:08 mvojkovi Exp $ */ + +#define NV_NEW + /* * RIVA Fixed Functionality Init Tables. */ @@ -61,6 +64,9 @@ static unsigned RivaTableFIFO[][2] = {0x00001800, 0x80000010}, {0x00002000, 0x80000011}, {0x00002800, 0x80000012}, +#ifdef NV_NEW + {0x00003000, 0x80000016}, +#endif {0x00003800, 0x80000013} }; static unsigned nv3TablePFIFO[][2] = @@ -166,6 +172,10 @@ static unsigned nv3TablePRAMIN[][2] = {0x00000249, 0x00CC0346}, {0x0000024C, 0x80000013}, {0x0000024D, 0x00D70347}, +#ifdef NV_NEW + {0x00000258, 0x80000016}, + {0x00000259, 0x00CA034C}, +#endif {0x00000D05, 0x00000000}, {0x00000D06, 0x00000000}, {0x00000D07, 0x00000000}, @@ -202,7 +212,13 @@ static unsigned nv3TablePRAMIN[][2] = {0x00000D2C, 0x10830200}, {0x00000D2D, 0x00000000}, {0x00000D2E, 0x00000000}, - {0x00000D2F, 0x00000000} + {0x00000D2F, 0x00000000} +#ifdef NV_NEW + , + {0x00000D31, 0x00000000}, + {0x00000D32, 0x00000000}, + {0x00000D33, 0x00000000} +#endif }; static unsigned nv3TablePRAMIN_8BPP[][2] = { @@ -215,6 +231,10 @@ static unsigned nv3TablePRAMIN_8BPP[][2] = {0x00000D14, 0x10110203}, {0x00000D18, 0x10110203}, {0x00000D1C, 0x10419208} +#ifdef NV_NEW + , + {0x00000D30, 0x10118203} +#endif }; static unsigned nv3TablePRAMIN_15BPP[][2] = { @@ -227,6 +247,10 @@ static unsigned nv3TablePRAMIN_15BPP[][2] = {0x00000D14, 0x10110200}, {0x00000D18, 0x10110200}, {0x00000D1C, 0x10419208} +#ifdef NV_NEW + , + {0x00000D30, 0x10118200} +#endif }; static unsigned nv3TablePRAMIN_32BPP[][2] = { @@ -239,6 +263,10 @@ static unsigned nv3TablePRAMIN_32BPP[][2] = {0x00000D14, 0x10110201}, {0x00000D18, 0x10110201}, {0x00000D1C, 0x10419208} +#ifdef NV_NEW + , + {0x00000D30, 0x10118201} +#endif }; static unsigned nv4TableFIFO[][2] = { @@ -362,6 +390,10 @@ static unsigned nv4TablePRAMIN[][2] = {0x00000009, 0x80011149}, {0x0000000A, 0x80000015}, {0x0000000B, 0x8001114A}, +#ifdef NV_NEW + {0x0000000C, 0x80000016}, + {0x0000000D, 0x8001114F}, +#endif {0x00000020, 0x80000000}, {0x00000021, 0x80011142}, {0x00000022, 0x80000001}, @@ -430,6 +462,12 @@ static unsigned nv4TablePRAMIN[][2] = {0x00000538, 0x0000005B}, {0x0000053A, 0x11401140}, {0x0000053B, 0x00000000} +#ifdef NV_NEW + , + {0x0000053C, 0x0300A01C}, + {0x0000053E, 0x11401140}, + {0x0000053F, 0x00000000} +#endif }; static unsigned nv4TablePRAMIN_8BPP[][2] = { @@ -444,7 +482,11 @@ static unsigned nv4TablePRAMIN_8BPP[][2] = {0x0000052D, 0x00000302}, {0x0000052E, 0x00000302}, {0x00000535, 0x00000000}, - {0x00000539, 0x00000000} + {0x00000539, 0x00000000} +#ifdef NV_NEW + , + {0x0000053D, 0x00000302} +#endif }; static unsigned nv4TablePRAMIN_15BPP[][2] = { @@ -460,6 +502,10 @@ static unsigned nv4TablePRAMIN_15BPP[][2] = {0x0000052E, 0x00000902}, {0x00000535, 0x00000702}, {0x00000539, 0x00000702} +#ifdef NV_NEW + , + {0x0000053D, 0x00000902} +#endif }; static unsigned nv4TablePRAMIN_16BPP[][2] = { @@ -475,6 +521,10 @@ static unsigned nv4TablePRAMIN_16BPP[][2] = {0x0000052E, 0x00000C02}, {0x00000535, 0x00000702}, {0x00000539, 0x00000702} +#ifdef NV_NEW + , + {0x0000053D, 0x00000C02} +#endif }; static unsigned nv4TablePRAMIN_32BPP[][2] = { @@ -490,6 +540,10 @@ static unsigned nv4TablePRAMIN_32BPP[][2] = {0x0000052E, 0x00000E02}, {0x00000535, 0x00000E02}, {0x00000539, 0x00000E02} +#ifdef NV_NEW + , + {0x0000053D, 0x00000E02} +#endif }; static unsigned nv10TableFIFO[][2] = { @@ -802,6 +856,10 @@ static unsigned nv10TablePRAMIN[][2] = {0x00000009, 0x80011149}, {0x0000000A, 0x80000015}, {0x0000000B, 0x8001114A}, +#ifdef NV_NEW + {0x0000000C, 0x80000016}, + {0x0000000D, 0x80011150}, +#endif {0x00000020, 0x80000000}, {0x00000021, 0x80011142}, {0x00000022, 0x80000001}, @@ -875,6 +933,12 @@ static unsigned nv10TablePRAMIN[][2] = {0x0000053C, 0x00000093}, {0x0000053E, 0x11401140}, {0x0000053F, 0x00000000} +#ifdef NV_NEW + , + {0x00000540, 0x0300A01C}, + {0x00000542, 0x11401140}, + {0x00000543, 0x00000000} +#endif }; static unsigned nv10TablePRAMIN_8BPP[][2] = { @@ -891,6 +955,10 @@ static unsigned nv10TablePRAMIN_8BPP[][2] = {0x00000535, 0x00000000}, {0x00000539, 0x00000000}, {0x0000053D, 0x00000000} +#ifdef NV_NEW + , + {0x00000541, 0x00000302} +#endif }; static unsigned nv10TablePRAMIN_15BPP[][2] = { @@ -907,6 +975,10 @@ static unsigned nv10TablePRAMIN_15BPP[][2] = {0x00000535, 0x00000902}, {0x00000539, 0x00000902}, {0x0000053D, 0x00000902} +#ifdef NV_NEW + , + {0x00000541, 0x00000902} +#endif }; static unsigned nv10TablePRAMIN_16BPP[][2] = { @@ -923,6 +995,10 @@ static unsigned nv10TablePRAMIN_16BPP[][2] = {0x00000535, 0x00000C02}, {0x00000539, 0x00000C02}, {0x0000053D, 0x00000C02} +#ifdef NV_NEW + , + {0x00000541, 0x00000C02} +#endif }; static unsigned nv10TablePRAMIN_32BPP[][2] = { @@ -939,5 +1015,9 @@ static unsigned nv10TablePRAMIN_32BPP[][2] = {0x00000535, 0x00000E02}, {0x00000539, 0x00000E02}, {0x0000053D, 0x00000E02} +#ifdef NV_NEW + , + {0x00000541, 0x00000E02} +#endif }; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h index 91676f19f..7adb19523 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.10 2000/06/17 00:03:22 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.11 2000/08/04 16:13:32 eich Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -213,6 +213,7 @@ typedef struct { I2CBusPtr i2c; XAAInfoRecPtr accel; + Bool accelOn; xf86CursorInfoPtr cursor; unsigned long cursor_start; unsigned long cursor_end; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c index bef8a4329..47a4bcdbf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.38 2000/07/01 01:40:45 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.40 2000/08/04 16:13:32 eich Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -1822,13 +1822,16 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) { if (R128AccelInit(pScreen)) { xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); + info->accelOn = TRUE; } else { xf86DrvMsg(scrnIndex, X_ERROR, "Acceleration initialization failed\n"); xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + info->accelOn = FALSE; } } else { xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + info->accelOn = FALSE; } /* Cursor setup */ @@ -1864,7 +1867,10 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, R128LoadPalette), NULL, CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH - | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE; +#if 0 /* This option messes up text mode! (eich@suse.de) */ + | CMAP_LOAD_EVEN_IF_OFFSCREEN +#endif + )) return FALSE; /* DPMS setup */ #ifdef DPMSExtension @@ -2665,6 +2671,7 @@ static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!R128Init(pScrn, mode, &info->ModeReg)) return FALSE; /* FIXME? DRILock/DRIUnlock here? */ + pScrn->vtSema = TRUE; R128Blank(pScrn); R128RestoreMode(pScrn, &info->ModeReg); R128Unblank(pScrn); @@ -2680,8 +2687,15 @@ static Bool R128SaveScreen(ScreenPtr pScreen, int mode) Bool unblank; unblank = xf86IsUnblank(mode); + if (unblank) + SetTimeSinceLastInputEvent(); - if (unblank) R128Unblank(pScrn); else R128Blank(pScrn); + if ((pScrn != NULL) && pScrn->vtSema) { + if (unblank) + R128Unblank(pScrn); + else + R128Blank(pScrn); + } return TRUE; } @@ -2738,6 +2752,9 @@ static Bool R128EnterVT(int scrnIndex, int flags) } #endif if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (info->accelOn) + R128EngineInit(pScrn); + info->PaletteSavedOnVT = FALSE; R128AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile index 4d81b42bd..2960e616c 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.16 2000/06/30 17:15:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.18 2000/08/02 20:43:26 dawes Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -6,12 +6,21 @@ XCOMM #define IHaveModules #include <Server.tmpl> +#if BuildXF86DRI +DRISRCS = sis_dri.c +DRIOBJS = sis_dri.o +DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ + -I$(XF86OSSRC)/linux/drm/kernel \ + -I$(XTOP)/include +DRIDEFINES = $(GLX_DEFINES) +#endif + SRCS = sis_driver.c sis_dac.c sis_cursor.c sis_accel.c sis_setup.c\ - sis530_accel.c sis300_accel.c sis_vga.c sis_tv.c sis_lcd.c\ - sis_opt.c sis_bios.c sis_dga.c + sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c\ + sis_opt.c init300.c init301.c sis_dga.c $(DRISRCS) OBJS = sis_driver.o sis_dac.o sis_cursor.o sis_accel.o sis_setup.o\ - sis530_accel.o sis300_accel.o sis_vga.o sis_tv.o sis_lcd.o\ - sis_opt.o sis_bios.o sis_dga.o + sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o\ + sis_opt.o init300.o init301.o sis_dga.o $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -19,15 +28,18 @@ INCLUDES = -I. -I../../include INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ - -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ - -I$(XF86SRC)/xf24_32bpp \ + -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ + -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ - -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/rac \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(XF86SRC)/rac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XTOP)/include/extensions + -I$(XTOP)/include/extensions \ + $(DRIINCLUDES) #endif +DEFINES = $(DRIDEFINES) + #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) #endif @@ -47,27 +59,24 @@ DependTarget() InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init300.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(init301.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis530_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_accel.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_bios.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_bios.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dac.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dga.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.h,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_lcd.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_lcd.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_opt.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_regs.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_regs2.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_setup.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_tv.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_tv.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_vb.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_vga.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKObjectModule(sis,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c new file mode 100644 index 000000000..5c4e01e98 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c @@ -0,0 +1,1030 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ + +#include "xf86.h" +#include "xf86PciInfo.h" + +#include "sis.h" +#include "sis_regs.h" +#include "init300.h" + +VOID SetReg1(USHORT, USHORT, USHORT); +VOID SetReg3(USHORT, USHORT); +VOID SetReg4(USHORT, ULONG); +USHORT GetReg1(USHORT, USHORT); +USHORT GetReg2(USHORT); +ULONG GetReg3(USHORT); +Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + ULONG temp; + USHORT cr30flag,cr31flag; + ULONG ROMAddr = (ULONG) SISPTR(pScrn)->BIOS; + USHORT BaseAddr = (USHORT) (SISPTR(pScrn)->RelIO +0x30); + USHORT ModeNo=0; + USHORT Rate; + + P3c4=BaseAddr+0x14; + P3d4=BaseAddr+0x24; + P3c0=BaseAddr+0x10; + P3ce=BaseAddr+0x1e; + P3c2=BaseAddr+0x12; + P3ca=BaseAddr+0x1a; + P3c6=BaseAddr+0x16; + P3c7=BaseAddr+0x17; + P3c8=BaseAddr+0x18; + P3c9=BaseAddr+0x19; + P3da=BaseAddr+0x2A; + + ModeNo = CalcModeIndex(pScrn, mode); + Rate = CalcRefreshRate(pScrn, mode); + SetReg1(P3d4, 0x33, Rate); + + SetReg1(P3c4, 0x20, 0xa1); + SetReg1(P3c4, 0x1E, 0x42); + + PresetScratchregister(P3d4); /* add for CRT2 */ + /* replace GetSenseStatus,SetTVSystem,SetDisplayInfo */ + + SetReg1(P3c4,0x05,0x86); /* 1.Openkey */ + temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ + if(temp==0) return(0); + + SetTVSystem(); /* add for CRT2 */ + GetLCDDDCInfo(pScrn); /* add for CRT2 */ + GetVBInfo(BaseAddr,ROMAddr); /* add for CRT2 */ + GetLCDResInfo(P3d4); /* add for CRT2 */ + + temp=CheckMemorySize(ROMAddr); /* 3.Check memory size */ + if(temp==0) return(0); + cr30flag=(UCHAR)GetReg1(P3d4,0x30); + if(((cr30flag&0x01)==1)||((cr30flag&0x02)==0)){ + /* if cr30 d[0]=1 or d[1]=0 set crt1 */ + SetReg1(P3d4,0x34,ModeNo); + /* set CR34->CRT1 ModeNofor CRT2 FIFO */ + GetModePtr(ROMAddr,ModeNo); /* 4.GetModePtr */ + SetSeqRegs(ROMAddr); /* 5.SetSeqRegs */ + SetMiscRegs(ROMAddr); /* 6.SetMiscRegs */ + SetCRTCRegs(ROMAddr); /* 7.SetCRTCRegs */ + SetATTRegs(ROMAddr); /* 8.SetATTRegs */ + SetGRCRegs(ROMAddr); /* 9.SetGRCRegs */ + ClearExt1Regs(); /* 10.Clear Ext1Regs */ + temp=GetRatePtr(ROMAddr,ModeNo); /* 11.GetRatePtr */ + if(temp) { + SetSync(ROMAddr); /* 12.SetSync */ + SetCRT1CRTC(ROMAddr); /* 13.SetCRT1CRTC */ + SetCRT1Offset(ROMAddr); /* 14.SetCRT1Offset */ + SetCRT1VCLK(ROMAddr); /* 15.SetCRT1VCLK */ + SetVCLKState(ROMAddr, ModeNo); + if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) + SetCRT1FIFO2(ROMAddr); + else + SetCRT1FIFO(ROMAddr); + } + SetCRT1ModeRegs(ROMAddr, ModeNo); + if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) + SetInterlace(ROMAddr,ModeNo); + LoadDAC(ROMAddr); + } + cr31flag=(UCHAR)GetReg1(P3d4,0x31); + if(((cr30flag&0x01)==1)||((cr30flag&0x03)==0x02)|| + (((cr30flag&0x03)==0x00)&&((cr31flag&0x20)==0x20))) { + /* if CR30 d[0]=1 or d[1:0]=10, set CRT2 or cr30 cr31== 0x00 0x20 */ + SetCRT2Group(BaseAddr,ROMAddr,ModeNo, pScrn); /* add for CRT2 */ + } + SetPitch(pScrn, BaseAddr); /* 16.SetPitch */ + DisplayOn(); /* 17.DisplayOn */ + return TRUE; +} + +BOOLEAN SearchModeID(ULONG ROMAddr, USHORT ModeNo) +{ + UCHAR ModeID; + USHORT usIDLength; + + ModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UCHAR *)(ROMAddr+ModeIDOffset)); /* Offset 0x20A */ + usIDLength = GetModeIDLength(ROMAddr, ModeNo); + while(ModeID!=0xff && ModeID!=ModeNo) { +/* ModeIDOffset=ModeIDOffset+10; */ /*StructSize */ + ModeIDOffset=ModeIDOffset+usIDLength; + ModeID=*((UCHAR *)(ROMAddr+ModeIDOffset)); + } + if(ModeID==0xff) return(FALSE); + else return(TRUE); +} + +BOOLEAN CheckMemorySize(ULONG ROMAddr) +{ + USHORT memorysize; + USHORT modeflag; + USHORT temp; + + modeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + ModeType=modeflag&ModeInfoFlag; /* Get mode type */ + + memorysize=modeflag&MemoryInfoFlag; + memorysize=memorysize>MemorySizeShift; + memorysize++; /* Get memory size */ + + temp=GetReg1(P3c4,0x14); /* Get DRAM Size */ + temp=temp&0x3F; + temp++; + + if(temp<memorysize) return(FALSE); + else return(TRUE); +} + +VOID GetModePtr(ULONG ROMAddr, USHORT ModeNo) +{ + UCHAR index; + + StandTable=*((USHORT *)(ROMAddr+0x202)); /* Get First 0x202 */ + /* StandTable Offset */ + if(ModeNo<=13) { + index=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+St_ModeFlag */ + } + else { + if(ModeType <= 0x02) index=0x1B; /* 02 -> ModeEGA */ + else index=0x0F; + } + StandTable=StandTable+64*index; +} + +VOID SetSeqRegs(ULONG ROMAddr) +{ + UCHAR SRdata; + USHORT i; + + SetReg1(P3c4,0x00,0x03); /* Set SR0 */ + StandTable=StandTable+0x05; + SRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get SR01 from file */ + SRdata=SRdata|0x20; + SetReg1(P3c4,0x01,SRdata); /* Set SR1 */ + for(i=02;i<=04;i++) { + StandTable++; + SRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get SR2,3,4 from file */ + SetReg1(P3c4,i,SRdata); /* Set SR2 3 4 */ + } +} + +VOID SetMiscRegs(ULONG ROMAddr) +{ + UCHAR Miscdata; + + StandTable++; + Miscdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get Misc from file */ + SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ +} + +VOID SetCRTCRegs(ULONG ROMAddr) +{ + UCHAR CRTCdata; + USHORT i; + + CRTCdata=(UCHAR)GetReg1(P3d4,0x11); + CRTCdata=CRTCdata&0x7f; + SetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ + + for(i=0;i<=0x18;i++) { + StandTable++; + CRTCdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get CRTC from file */ + SetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + } +} + +VOID SetATTRegs(ULONG ROMAddr) +{ + UCHAR ARdata; + USHORT i; + + for(i=0;i<=0x13;i++) { + StandTable++; + ARdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get AR for file */ + GetReg2(P3da); /* reset 3da */ + SetReg3(P3c0,i); /* set index */ + SetReg3(P3c0,ARdata); /* set data */ + } + GetReg2(P3da); /* reset 3da */ + SetReg3(P3c0,0x14); /* set index */ + SetReg3(P3c0,0x00); /* set data */ + GetReg2(P3da); /* Enable Attribute */ + SetReg3(P3c0,0x20); +} + +VOID SetGRCRegs(ULONG ROMAddr) +{ + UCHAR GRdata; + USHORT i; + + for(i=0;i<=0x08;i++) { + StandTable++; + GRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get GR from file */ + SetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ + } + if(ModeType>ModeVGA){ + GRdata=(UCHAR)GetReg1(P3ce,0x05); + GRdata=GRdata&0xBF; + SetReg1(P3ce,0x05,GRdata); + } +} + +VOID ClearExt1Regs() +{ + USHORT i; + + for(i=0x0A;i<=0x0E;i++) SetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ +} + + +BOOLEAN GetRatePtr(ULONG ROMAddr, USHORT ModeNo) +{ + SHORT index; + USHORT temp; + USHORT ulRefIndexLength; + + if(ModeNo<0x14) return(FALSE); /* Mode No <= 13h then return */ + + index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=index&0x0F; /* Frame rate index */ + if(index!=0) index--; + REFIndex=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + + ulRefIndexLength = GetRefindexLength(ROMAddr, ModeNo); + do { + temp=*((USHORT *)(ROMAddr+REFIndex)); /* di => REFIndex */ + if(temp==0xFFFF) break; + temp=temp&ModeInfoFlag; + if(temp<ModeType) break; + + REFIndex=REFIndex+ulRefIndexLength; /* rate size */ + index--; + } while(index>=0); + + REFIndex=REFIndex-ulRefIndexLength; /* rate size */ + return(TRUE); +} + +VOID SetSync(ULONG ROMAddr) +{ + USHORT sync; + USHORT temp; + + sync=*((USHORT *)(ROMAddr+REFIndex)); /* di+0x00 */ + sync=sync&0xC0; + temp=0x2F; + temp=temp|sync; + SetReg3(P3c2,temp); /* Set Misc(3c2) */ +} + +VOID SetCRT1CRTC(ULONG ROMAddr) +{ + UCHAR index; + UCHAR data; + USHORT i; + + index=*((UCHAR *)(ROMAddr+REFIndex+0x02)) & 0x3F; /* Get index */ + CRT1Table=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ + CRT1Table=CRT1Table+index*CRT1Len; + + data=(UCHAR)GetReg1(P3d4,0x11); + data=data&0x7F; + SetReg1(P3d4,0x11,data); /* Unlock CRTC */ + + CRT1Table--; + for(i=0;i<=0x05;i++) { + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x06;i<=0x07;i++) { + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x10;i<=0x12;i++) { + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x15;i<=0x16;i++) { + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x0A;i<=0x0C;i++) { + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + SetReg1(P3c4,i,data); + } + + CRT1Table++; + data=*((UCHAR *)(ROMAddr+CRT1Table)); + data=data&0xE0; + SetReg1(P3c4,0x0E,data); + + data=(UCHAR)GetReg1(P3d4,0x09); + data=data&0xDF; + i=*((UCHAR *)(ROMAddr+CRT1Table)); + i=i&0x01; + i=i<<5; + data=data|i; + i=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + i=i&DoubleScanMode; + if(i) data=data|0x80; + SetReg1(P3d4,0x09,data); + + if(ModeType>0x03) SetReg1(P3d4,0x14,0x4F); +} + +VOID SetCRT1Offset(ULONG ROMAddr) +{ + USHORT temp,ah,al; + USHORT temp2,i; + USHORT DisplayUnit; + + temp=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ + temp=temp>>4; /* index */ + ScreenOffset=*((USHORT *)(ROMAddr+0x206)); /* ScreenOffset */ + temp=*((UCHAR *)(ROMAddr+ScreenOffset+temp)); /* data */ + + temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); + temp2=temp2&InterlaceMode; + if(temp2) temp=temp<<1; + temp2=ModeType-ModeEGA; + switch (temp2) { + case 0 : temp2=1; break; + case 1 : temp2=2; break; + case 2 : temp2=4; break; + case 3 : temp2=4; break; + case 4 : temp2=6; break; + case 5 : temp2=8; break; + } + temp=temp*temp2; + DisplayUnit=temp; + + temp2=temp; + temp=temp>>8; /* ah */ + temp=temp&0x0F; + i=GetReg1(P3c4,0x0E); + i=i&0xF0; + i=i|temp; + SetReg1(P3c4,0x0E,i); + + temp=(UCHAR)temp2; + temp=temp&0xFF; /* al */ + SetReg1(P3d4,0x13,temp); + + temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); + temp2=temp2&InterlaceMode; + if(temp2) DisplayUnit>>=1; + + DisplayUnit=DisplayUnit<<5; + ah=(DisplayUnit&0xff00)>>8; + al=DisplayUnit&0x00ff; + if(al==0) ah=ah+1; + else ah=ah+2; + SetReg1(P3c4,0x10,ah); +} + +VOID SetCRT1VCLK(ULONG ROMAddr) +{ + USHORT i; + UCHAR index,data; + + index=*((UCHAR *)(ROMAddr+REFIndex+0x03)) & 0x3F; + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((USHORT *)(ROMAddr+0x208)); + VCLKData=VCLKData+data; + + SetReg1(P3c4,0x31,0); + for(i=0x2B;i<=0x2C;i++) { + data=*((UCHAR *)(ROMAddr+VCLKData)); + SetReg1(P3c4,i,data); + VCLKData++; + } + SetReg1(P3c4,0x2D,0x80); +} + + +VOID SetCRT1ModeRegs(ULONG ROMAddr, USHORT ModeNo) +{ + USHORT data,data2,data3; + + if(ModeNo>0x13) data=*((USHORT *)(ROMAddr+REFIndex+0x00)); + else data=0; + data2=0; + if(ModeNo>0x13) + if(ModeType>0x02) { + data2=data2|0x02; + data3=ModeType-ModeVGA; + data3=data3<<2; + data2=data2|data3; + } + + data=data&InterlaceMode; + if(data) data2=data2|0x20; + SetReg1(P3c4,0x06,data2); + + data=GetReg1(P3c4,0x01); + data=data&0xF7; + data2=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + data2=data2&HalfDCLK; + if(data2) data=data|0x08; + SetReg1(P3c4,0x01,data); + + data=GetReg1(P3c4,0x0F); + data=data&0xF7; + data2=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + data2=data2&LineCompareOff; + if(data2) data=data|0x08; + SetReg1(P3c4,0x0F,data); + + data=GetReg1(P3c4,0x21); + data=data&0x1F; + if(ModeType==0x00) data=data|0x60; /* Text Mode */ + else if(ModeType<=0x02) data=data|0x00; /* EGA Mode */ + else data=data|0xA0; /* VGA Mode */ + SetReg1(P3c4,0x21,data); +} + +VOID SetVCLKState(ULONG ROMAddr, USHORT ModeNo) +{ + USHORT data,data2; + USHORT VCLK; + UCHAR index; + + index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((USHORT *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((USHORT *)(ROMAddr+VCLKData)); + if(ModeNo<=0x13) VCLK=0; + + data=GetReg1(P3c4,0x07); + data=data&0x7B; + if(VCLK>=150) data=data|0x80; /* VCLK > 150 */ + SetReg1(P3c4,0x07,data); + + data=GetReg1(P3c4,0x32); + data=data&0xD7; + if(VCLK>=150) data=data|0x08; /* VCLK > 150 */ + SetReg1(P3c4,0x32,data); + + data2=0x03; + if(VCLK>135) data2=0x02; + if(VCLK>160) data2=0x01; + if(VCLK>260) data2=0x00; + data=GetReg1(P3c4,0x07); + data=data&0xFC; + data=data|data2; + SetReg1(P3c4,0x07,data); +} + +VOID LoadDAC(ULONG ROMAddr) +{ + USHORT data,data2; + USHORT time,i,j,k; + USHORT m,n,o; + USHORT si,di,bx,dl; + USHORT al,ah,dh; + USHORT *table=0; + + data=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + data=data&DACInfoFlag; + time=64; + if(data==0x00) table=MDA_DAC; + if(data==0x08) table=CGA_DAC; + if(data==0x10) table=EGA_DAC; + if(data==0x18) { + time=256; + table=VGA_DAC; + } + if(time==256) j=16; + else j=time; + + SetReg3(P3c6,0xFF); + SetReg3(P3c8,0x00); + + for(i=0;i<j;i++) { + data=table[i]; + for(k=0;k<3;k++) { + data2=0; + if(data&0x01) data2=0x2A; + if(data&0x02) data2=data2+0x15; + SetReg3(P3c9,data2); + data=data>>2; + } + } + + if(time==256) { + for(i=16;i<32;i++) { + data=table[i]; + for(k=0;k<3;k++) SetReg3(P3c9,data); + } + si=32; + for(m=0;m<9;m++) { + di=si; + bx=si+0x04; + dl=0; + for(n=0;n<3;n++) { + for(o=0;o<5;o++) { + dh=table[si]; + ah=table[di]; + al=table[bx]; + si++; + WriteDAC(dl,ah,al,dh); + } /* for 5 */ + si=si-2; + for(o=0;o<3;o++) { + dh=table[bx]; + ah=table[di]; + al=table[si]; + si--; + WriteDAC(dl,ah,al,dh); + } /* for 3 */ + dl++; + } /* for 3 */ + si=si+5; + } /* for 9 */ + } +} + +VOID WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh) +{ + USHORT temp; + USHORT bh,bl; + + bh=ah; + bl=al; + if(dl!=0) { + temp=bh; + bh=dh; + dh=temp; + if(dl==1) { + temp=bl; + bl=dh; + dh=temp; + } + else { + temp=bl; + bl=bh; + bh=temp; + } + } + SetReg3(P3c9,(USHORT)dh); + SetReg3(P3c9,(USHORT)bh); + SetReg3(P3c9,(USHORT)bl); +} + +VOID DisplayOn() +{ + USHORT data; + + data=GetReg1(P3c4,0x01); + data=data&0xDF; + SetReg1(P3c4,0x01,data); +} + +VOID SetReg1(USHORT port, USHORT index, USHORT data) +{ + outb(port ,(UCHAR)(index & 0xff)); + port++; + outb(port ,(UCHAR)(data & 0xff)); +} + +VOID SetReg3(USHORT port, USHORT data) +{ + outb(port, (UCHAR)(data & 0xff)); +} + +USHORT GetReg1(USHORT port, USHORT index) +{ + UCHAR data; + + outb(port, (UCHAR)(index & 0xff)); + port += 1; + data = inb(port); + return(data); +} + +USHORT GetReg2(USHORT port) +{ + UCHAR data; + + data = inb(port); + + return(data); +} + +USHORT GetModeIDLength(ULONG ROMAddr, USHORT ModeNo) +{ + UCHAR ModeID; + USHORT modeidlength; + USHORT usModeIDOffset; + + return(10); + modeidlength=0; + usModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ + while(ModeID!=0x2E) { + modeidlength++; + usModeIDOffset=usModeIDOffset+1; /* 10 <= ExtStructSize */ + ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); + } + return(modeidlength); +} + +USHORT GetRefindexLength(ULONG ROMAddr, USHORT ModeNo) +{ + UCHAR ModeID; + UCHAR temp; + USHORT refindexlength; + USHORT usModeIDOffset; + USHORT usREFIndex; + USHORT usIDLength; + + usModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ + usIDLength = GetModeIDLength(ROMAddr, ModeNo); + while(ModeID!=0x40) { + usModeIDOffset=usModeIDOffset+usIDLength; /*10 <= ExtStructSize */ + ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); + } + + refindexlength=1; + usREFIndex=*((USHORT *)(ROMAddr+usModeIDOffset+0x04)); /* si+Ext_point */ + usREFIndex++; + temp=*((UCHAR *)(ROMAddr+usREFIndex)); /* di => REFIndex */ + while(temp!=0xFF) { + refindexlength++; + usREFIndex++; + temp=*((UCHAR *)(ROMAddr+usREFIndex)); /* di => REFIndex */ + } + return(refindexlength); +} + +VOID SetInterlace(ULONG ROMAddr, USHORT ModeNo) +{ + ULONG Temp; + USHORT data,Temp2; + + Temp = (ULONG)GetReg1(P3d4, 0x01); + Temp++; + Temp=Temp*8; + + if(Temp==1024) data=0x0035; + else if(Temp==1280) data=0x0048; + else data=0x0000; + + Temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); + Temp2 &= InterlaceMode; + if(Temp2 == 0) data=0x0000; + + SetReg1(P3d4,0x19,data); + + Temp = (ULONG)GetReg1(P3d4, 0x1A); + Temp2= (USHORT)(Temp & 0xFC); + SetReg1(P3d4,0x1A,(USHORT)Temp); + + Temp = (ULONG)GetReg1(P3c4, 0x0f); + Temp2= (USHORT)Temp & 0xBF; + if(ModeNo==0x37) Temp2=Temp2|0x40; + SetReg1(P3d4,0x1A,(USHORT)Temp2); +} + +VOID SetCRT1FIFO(ULONG ROMAddr) +{ + USHORT index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; + USHORT ah,bl,A,B; + + index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((USHORT *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((USHORT *)(ROMAddr+VCLKData)); /* Get VCLK */ + + MCLKOffset=*((USHORT *)(ROMAddr+0x20C)); + index=GetReg1(P3c4,0x3A); + index=index&07; + MCLKOffset=MCLKOffset+index*5; + MCLK=*((UCHAR *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ + + data2=ModeType-0x02; + switch (data2) { + case 0 : colorth=1; break; + case 1 : colorth=2; break; + case 2 : colorth=4; break; + case 3 : colorth=4; break; + case 4 : colorth=6; break; + case 5 : colorth=8; break; + } + + do{ +/*==============*/ + B=(USHORT)(CalcDelay(ROMAddr,0)*VCLK*colorth); + B=B/(16*MCLK); + B++; + + A=(CalcDelay(ROMAddr,1)*VCLK*colorth); + A=A/(16*MCLK); + A++; + + if(A<4) A=0; + else A=A-4; + + if(A>B) bl=A; + else bl=B; + + bl++; + if(bl>0x13) { + data=GetReg1(P3c4,0x16); + data=data>>6; + if(data!=0) { + data--; + data=data<<6; + data2=GetReg1(P3c4,0x16); + data2=(data2&0x3f)|data; + SetReg1(P3c4,0x16,data2); + } + else bl=0x13; + } +/*==============*/ + } while(bl>0x13); + + ah=bl; + ah=ah<<4; + ah=ah|0x0f; + SetReg1(P3c4,0x08,ah); + + data=bl; + data=data&0x10; + data=data<<1; + data2=GetReg1(P3c4,0x0F); + data2=data2&0x9f; + data2=data2|data; + SetReg1(P3c4,0x0F,data2); + + data=bl+3; + if(data>0x0f) data=0x0f; + SetReg1(P3c4,0x3b,0x00); + data2=GetReg1(P3c4,0x09); + data2=data2&0xF0; + data2=data2|data; + SetReg1(P3c4,0x09,data2); +} + +USHORT CalcDelay(ULONG ROMAddr,USHORT key) +{ + USHORT data,data2,temp0,temp1; + UCHAR ThLowA[]= {61,3,52,5,68,7,100,11, + 43,3,42,5,54,7, 78,11, + 34,3,37,5,47,7, 67,11}; + UCHAR ThLowB[]= {81,4,72,6,88,8,120,12, + 55,4,54,6,66,8, 90,12, + 42,4,45,6,55,8, 75,12}; + UCHAR ThTiming[]= {1,2,2,3,0,1,1,2}; + + data=GetReg1(P3c4,0x16); + data=data>>6; + data2=GetReg1(P3c4,0x14); + data2=(data2>>4)&0x0C; + data=data|data2; + data=data<1; + if(key==0) { + temp0=(USHORT)ThLowA[data]; + temp1=(USHORT)ThLowA[data+1]; + } + else { + temp0=(USHORT)ThLowB[data]; + temp1=(USHORT)ThLowB[data+1]; + } + + data2=0; + data=GetReg1(P3c4,0x18); + if(data&0x02) data2=data2|0x01; + if(data&0x20) data2=data2|0x02; + if(data&0x40) data2=data2|0x04; + + data=temp1*ThTiming[data2]+temp0; + return(data); +} + +VOID SetCRT1FIFO2(ULONG ROMAddr) +{ + USHORT index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; + USHORT ah,bl,B; + ULONG eax; + + index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((USHORT *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((USHORT *)(ROMAddr+VCLKData)); /* Get VCLK */ + + MCLKOffset=*((USHORT *)(ROMAddr+0x20C)); + index=GetReg1(P3c4,0x1A); + index=index&07; + MCLKOffset=MCLKOffset+index*5; + MCLK=*((USHORT *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ + + data2=ModeType-0x02; + switch (data2) { + case 0 : colorth=1; break; + case 1 : colorth=1; break; + case 2 : colorth=2; break; + case 3 : colorth=2; break; + case 4 : colorth=3; break; + case 5 : colorth=4; break; + } + + do{ +/*==============*/ + B=(CalcDelay2(ROMAddr,0)*VCLK*colorth); + if (B%(16*MCLK) == 0) + { + B=B/(16*MCLK); + bl=B+1; + } + else + { + B=B/(16*MCLK); + bl=B+2; + } + + if(bl>0x13) { + data=GetReg1(P3c4,0x15); + data=data&0xf0; + if(data!=0xb0) { + data=data+0x20; + if(data==0xa0) data=0x30; + + data2=GetReg1(P3c4,0x15); + data2=(data2&0x0f)|data; + SetReg1(P3c4,0x15,data2); + } + else bl=0x13; + } +/*==============*/ + } while(bl>0x13); + + data2=GetReg1(P3c4,0x15); + data2=(data2&0xf0)>>4; + data2=data2<<24; + +/* ========================*/ + SetReg4(0xcf8,0x80000050); + eax=GetReg3(0xcfc); + eax=eax&0x0f0ffffff; + eax=eax|data2; + SetReg4(0xcfc,eax); +/* ========================*/ + + ah=bl; + ah=ah<<4; + ah=ah|0x0f; + SetReg1(P3c4,0x08,ah); + + data=bl; + data=data&0x10; + data=data<<1; + data2=GetReg1(P3c4,0x0F); + data2=data2&0x9f; + data2=data2|data; + SetReg1(P3c4,0x0F,data2); + + data=bl+3; + if(data>0x0f) data=0x0f; + SetReg1(P3c4,0x3b,0x00); + data2=GetReg1(P3c4,0x09); + data2=data2&0xF0; + data2=data2|data; + SetReg1(P3c4,0x09,data2); +} + +USHORT CalcDelay2(ULONG ROMAddr,USHORT key) +{ + USHORT data,index; + UCHAR LatencyFactor[]={88,80,78,72,70,00, + 00,79,77,71,69,49, + 88,80,78,72,70,00, + 00,72,70,64,62,44}; + + index=0; + data=GetReg1(P3c4,0x14); + if(data&0x80) index=index+12; + + data=GetReg1(P3c4,0x15); + data=(data&0xf0)>>4; + if(data&0x01) index=index+6; + + data=data>>1; + index=index+data; + data=LatencyFactor[index]; + + return(data); +} + +VOID SetReg4(USHORT port, ULONG data) +{ + outl(port, (ULONG)(data & 0xffffffff)); +} + +ULONG GetReg3(USHORT port) +{ + ULONG data; + + data = inl(port); + return(data); +} + +VOID SetPitch(ScrnInfoPtr pScrn, USHORT BaseAddr) +{ + SISPtr pSiS = SISPTR(pScrn); + ULONG HDisplay; + ULONG temp; + USHORT Port = BaseAddr + IND_SIS_CRT2_PORT_04; + + HDisplay = pSiS->scrnOffset / 8; + SetReg1(P3d4, 0x13, HDisplay); + temp = (GetReg1(P3c4, 0x0E) & 0xF0) | (HDisplay>>8); + SetReg1(P3c4, 0x0E, temp); + + SetReg1(Port, 0x24, 1); + SetReg1(Port, 0x07, HDisplay); + temp = (GetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); + SetReg1(Port, 0x09, temp); + + +} +USHORT CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + USHORT i = (pScrn->bitsPerPixel+7)/8 - 1; + USHORT ModeIndex = 0; + switch(mode->HDisplay) + { + case 640: + ModeIndex = ModeIndex_640x480[i]; + break; + case 800: + ModeIndex = ModeIndex_800x600[i]; + break; + case 1024: + ModeIndex = ModeIndex_1024x768[i]; + break; + case 1280: + ModeIndex = ModeIndex_1280x1024[i]; + break; + case 1600: + ModeIndex = ModeIndex_1600x1200[i]; + break; + } + + return(ModeIndex); +} +USHORT CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + USHORT Index=0; + USHORT i=0; + USHORT Rate=1; + USHORT temp = (int)(mode->VRefresh+0.5); + + switch(mode->HDisplay) + { + case 640: + Index = 0; + break; + case 800: + Index = 1; + break; + case 1024: + Index = 2; + Rate = 2; + break; + case 1280: + Index = 3; + Rate = 2; + break; + case 1600: + Index = 4; + break; + + } + while(RefreshRate[Index][i] != 0) + { + if(temp == RefreshRate[Index][i]) + { + Rate=i+1; + break; + } + else + i++; + } + if(pSiS->VBFlags & CRT2_VGA) + Rate |= Rate << 4; + return(Rate); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h new file mode 100644 index 000000000..1dfa249b8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h @@ -0,0 +1,110 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h,v 1.2 2000/08/03 12:24:03 dawes Exp $ */ + +#include "initdef.h" + +USHORT DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35},{0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31},{0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34},{0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21},{0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11},{0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01},{0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20},{0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00}}; + +USHORT MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; + +USHORT CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +USHORT EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, + 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, + 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, + 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, + 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, + 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, + 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +USHORT VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, + 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, + + 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, + 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, + 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, + 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, + 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, + 0x0B,0x0C,0x0D,0x0F,0x10}; + +USHORT ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; +USHORT ModeIndex_800x600[] = {0x30, 0x47, 0x48, 0x63}; +USHORT ModeIndex_1024x768[] = {0x38, 0x4A, 0x4B, 0x64}; +USHORT ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x4E, 0x65}; +USHORT ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x3E, 0x66}; +USHORT RefreshRate[5][8] = { + {60, 72, 75, 85, 100, 120, 160, 200}, + {56, 60, 72, 75, 85, 100, 120, 160}, + {43, 60, 70, 75, 85, 100, 120, 0}, + {43, 60, 75, 85, 0, 0, 0, 0}, + {60, 65, 70, 75, 85, 0, 0, 0}}; + +USHORT P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; +USHORT CRT1VCLKLen; /*VCLKData table length of bytes of each entry*/ +USHORT flag_clearbuffer; /*0: no clear frame buffer 1:clear frame buffer*/ +int RAMType; +int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData, ECLKData; +int REFIndex,ModeType; + +USHORT CalcRefreshRate(ScrnInfoPtr, DisplayModePtr); +USHORT CalcModeIndex(ScrnInfoPtr, DisplayModePtr); +BOOLEAN SearchModeID(ULONG, USHORT); +BOOLEAN CheckMemorySize(ULONG); +VOID GetModePtr(ULONG, USHORT); +BOOLEAN GetRatePtr(ULONG, USHORT); +VOID SetSeqRegs(ULONG); +VOID SetMiscRegs(ULONG); +VOID SetCRTCRegs(ULONG); +VOID SetATTRegs(ULONG); +VOID SetGRCRegs(ULONG); +VOID ClearExt1Regs(VOID); +VOID SetSync(ULONG); +VOID SetCRT1CRTC(ULONG); +VOID SetCRT1Offset(ULONG); +VOID SetCRT1FIFO(ULONG); +VOID SetCRT1FIFO2(ULONG); +VOID SetCRT1VCLK(ULONG); +VOID LoadDAC(ULONG); +VOID DisplayOn(); +VOID SetPitch(ScrnInfoPtr, USHORT); +VOID SetCRT1ModeRegs(ULONG, USHORT); +VOID SetVCLKState(ULONG, USHORT); +VOID WriteDAC(USHORT, USHORT, USHORT, USHORT); +USHORT GetModeIDLength(ULONG, USHORT); +USHORT GetRefindexLength(ULONG, USHORT); +VOID SetInterlace(ULONG, USHORT); +USHORT CalcDelay2(ULONG ,USHORT); +USHORT CalcDelay(ULONG ,USHORT); + +extern BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); +extern VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr); +extern VOID PresetScratchregister(USHORT P3d4); +extern BOOLEAN GetLCDResInfo(USHORT P3d4); +extern VOID SetTVSystem(); +extern BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn); +extern USHORT GetVCLKLen(ULONG ROMAddr); + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c new file mode 100644 index 000000000..1c3d44010 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c @@ -0,0 +1,1885 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.1 2000/08/01 20:52:24 dawes Exp $ */ + +#include "xf86.h" +#include "xf86PciInfo.h" + +#include "sis.h" +#include "sis_regs.h" + +#include "init301.h" + +BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, ScrnInfoPtr pScrn) +{ + USHORT temp; + + SetFlag=SetFlag|ProgrammingCRT2; + SearchModeID(ROMAddr,ModeNo); + temp=GetRatePtrCRT2(ROMAddr,ModeNo); + if(((temp&0x02)==0) && ((VBInfo&CRT2DisplayFlag)==0)) + return(FALSE); + SaveCRT2Info(ModeNo); + + DisableBridge(BaseAddr); + UnLockCRT2(BaseAddr); + SetDefCRT2ExtRegs(BaseAddr); + SetCRT2ModeRegs(BaseAddr,ModeNo); + if(VBInfo&CRT2DisplayFlag){ + LockCRT2(BaseAddr); + return 0; + } + GetCRT2Data(ROMAddr,ModeNo); + SetGroup1(BaseAddr,ROMAddr,ModeNo,pScrn); + SetGroup2(BaseAddr,ROMAddr); + SetGroup3(BaseAddr); + SetGroup4(BaseAddr,ROMAddr,ModeNo); + SetGroup5(BaseAddr,ROMAddr); + + EnableCRT2(); + EnableBridge(BaseAddr); + SetLockRegs(); + LockCRT2(BaseAddr); + return 1; +} + +VOID SetDefCRT2ExtRegs(USHORT BaseAddr) +{ + USHORT Part1Port,Part2Port,Part4Port; + USHORT temp; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + SetReg1(Part1Port,0x02,0x40); + SetReg1(Part4Port,0x10,0x80); + temp=(UCHAR)GetReg1(P3c4,0x16); + temp=temp&0xC3; + SetReg1(P3d4,0x35,temp); + +} + +USHORT GetRatePtrCRT2(ULONG ROMAddr, USHORT ModeNo) +{ /* return bit0=>0:standard mode 1:extended mode */ + SHORT index; /* bit1=>0:crt2 no support this mode */ + USHORT temp; /* 1:crt2 support this mode */ + USHORT ulRefIndexLength; + USHORT temp1; + SHORT LCDRefreshIndex[2]={0x03,0x01}; + + if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ + + index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=index>>SelectCRT2Rate; /* For CRT2,cl=SelectCRT2Rate=4, shr ah,cl */ + index=index&0x0F; /* Frame rate index */ + if(index!=0) index--; + + if(SetFlag&ProgrammingCRT2){ + if(VBInfo&SetCRT2ToLCD){ + temp=LCDResInfo; + temp1=LCDRefreshIndex[temp]; + if(index>temp1){ + index=temp1; + } + } + } + + REFIndex=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + + ulRefIndexLength =Ext2StructSize; + do { + temp=*((USHORT *)(ROMAddr+REFIndex)); /* di => REFIndex */ + if(temp==0xFFFF) break; + temp=temp&ModeInfoFlag; + if(temp<ModeType) break; + + REFIndex=REFIndex+ulRefIndexLength; /* rate size */ + index--; + if(index<0){ + if(!(VBInfo&SetCRT2ToRAMDAC)){ + if(VBInfo&SetInSlaveMode){ + temp1=*((USHORT *)(ROMAddr+REFIndex+0-Ext2StructSize)); + if(temp1&InterlaceMode){ + index=0; + } + } + } + } + } while(index>=0); + REFIndex=REFIndex-ulRefIndexLength; /* rate size */ + + if((SetFlag&ProgrammingCRT2)){ + temp1=AjustCRT2Rate(ROMAddr); + }else{ + temp1=0; + } + + return(0x01|(temp1<<1)); +} + +BOOLEAN AjustCRT2Rate(ULONG ROMAddr) +{ + USHORT tempax,tempbx,temp; + USHORT tempextinfoflag; + tempax=0; + if(VBInfo&SetCRT2ToRAMDAC){ + tempax=tempax|SupportRAMDAC2; + } + if(VBInfo&SetCRT2ToLCD){ + tempax=tempax|SupportLCD; + if(LCDResInfo!=Panel1280x1024){ + temp=*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + if(temp>=9){ + tempax=0; + } + } + } + if(VBInfo&(SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)){ + tempax=tempax|SupportTV; + if(!(VBInfo&SetPALTV)){ + tempextinfoflag=*((USHORT *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag&NoSupportSimuTV){ + if(VBInfo&SetInSlaveMode){ + if(!(VBInfo&SetNotSimuTVMode)){ + return 0; + } + } + } + } + } + tempbx=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + for(;REFIndex>tempbx;REFIndex-=Ext2StructSize){ + tempextinfoflag=*((USHORT *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag&tempax){ + return 1; + } + } + for(REFIndex=tempbx;;REFIndex+=Ext2StructSize){ + tempextinfoflag=*((USHORT *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag==0x0FFFF){ + return 0; + } + if(tempextinfoflag&tempax){ + return 1; + } + } + return(FALSE); +} + +VOID SaveCRT2Info(USHORT ModeNo) +{ + USHORT temp1,temp2,temp3; + temp1=(VBInfo&SetInSlaveMode)>>8; + temp2=~(SetInSlaveMode>>8); + temp3=(UCHAR)GetReg1(P3d4,0x31); + temp3=((temp3&temp2)|temp1); + SetReg1(P3d4,0x31,(USHORT)temp3); + temp3=(UCHAR)GetReg1(P3d4,0x35); + temp3=temp3&0xF3; + SetReg1(P3d4,0x35,(USHORT)temp3); +} + +VOID DisableLockRegs(){ + UCHAR temp3; + temp3=(UCHAR)GetReg1(P3c4,0x32); + temp3=temp3&0xDF; + SetReg1(P3c4,0x32,(USHORT)temp3); +} + +VOID DisableCRT2(){ + UCHAR temp3; + temp3=(UCHAR)GetReg1(P3c4,0x1E); + temp3=temp3&0xDF; + SetReg1(P3c4,0x1E,(USHORT)temp3); +} + +VOID DisableBridge(USHORT BaseAddr) +{ + UCHAR temp3,part2_02,part2_05; + USHORT Part2Port; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + + part2_02=(UCHAR)GetReg1(Part2Port,0x02); + part2_05=(UCHAR)GetReg1(Part2Port,0x05); + if(!WaitVBRetrace(BaseAddr)) /* return 0:no enable read dram */ + { + LongWait(); + DisableLockRegs(); + } + SetReg1(Part2Port,0x02,0x38); + SetReg1(Part2Port,0x05,0xFF); + temp3=(UCHAR)GetReg1(Part2Port,0x00); + temp3=temp3&0xDF; + SetReg1(Part2Port,0x00,(USHORT)temp3); + SetReg1(Part2Port,0x02,part2_02); + SetReg1(Part2Port,0x05,part2_05); + DisableCRT2(); +} + +VOID GetCRT2Data(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempax,tempbx,modeflag1,OldREFIndex; + USHORT tempal,tempah,tempbl; + + OldREFIndex=REFIndex; /* push di */ + RVBHRS=50;NewFlickerMode=0;RY1COE=0; + RY2COE=0;RY3COE=0;RY4COE=0; + + GetResInfo(ROMAddr,ModeNo); + if(VBInfo&SetCRT2ToRAMDAC){ + GetRAMDAC2DATA(ROMAddr,ModeNo); + REFIndex=OldREFIndex; /* pop di */ + return; + } + GetCRT2Ptr(ROMAddr,ModeNo); + + tempal=*((UCHAR *)(ROMAddr+REFIndex)); + tempah=*((UCHAR *)(ROMAddr+REFIndex+4)); + tempax=tempal|(((tempah<<8)>>7)&0xFF00); + RVBHCMAX=tempax; + + tempal=*((UCHAR *)(ROMAddr+REFIndex+1)); + RVBHCFACT=tempal; + + tempax=*((USHORT *)(ROMAddr+REFIndex+2)); + VGAHT=(tempax&0x0FFF); + + tempax=*((USHORT *)(ROMAddr+REFIndex+3)); + VGAVT=((tempax>>4)&0x07FF); + + tempax=*((USHORT *)(ROMAddr+REFIndex+5)); + tempax=(tempax&0x0FFF); + tempbx=*((USHORT *)(ROMAddr+REFIndex+6)); + tempbx=((tempbx>>4)&0x07FF); + tempbl=tempbx&0x00FF; + + if(VBInfo&SetCRT2ToTV){ + tempax=*((USHORT *)(ROMAddr+REFIndex+5)); + tempax=(tempax&0x0FFF); + HDE=tempax; + tempax=*((USHORT *)(ROMAddr+REFIndex+6)); + tempax=((tempax>>4)&0x07FF); + VDE=tempax; + /* skipp something about hivisiontv */ + tempax=*((USHORT *)(ROMAddr+REFIndex+8)); + tempbl=(tempax>>8); + tempax=tempax&0x0FFF; + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK){ + tempax=*((USHORT *)(ROMAddr+REFIndex+10)); + } + RVBHRS=tempax; + NewFlickerMode=(tempbl&0x080); + + tempax=*((USHORT *)(ROMAddr+REFIndex+12)); + RY1COE=(tempax&0x00FF); + RY2COE=((tempax&0xFF00)>>8); + tempax=*((USHORT *)(ROMAddr+REFIndex+14)); + RY3COE=(tempax&0x00FF); + RY4COE=((tempax&0xFF00)>>8); + if(!(VBInfo&SetPALTV)){ + tempax=NTSCHT; + tempbx=NTSCVT; + }else{ + tempax=PALHT; + tempbx=PALVT; + } + } + HT=tempax; + VT=tempbx; + if(!(VBInfo&SetCRT2ToLCD)){ + REFIndex=OldREFIndex; /* pop di */ + return; + } + + tempax=1024; + if(VGAVDE==350){ /* cx->VGAVDE */ + tempbx=560; + }else if(VGAVDE==400){ + tempbx=640; + }else{ + tempbx=768; + } + + if(LCDResInfo==Panel1280x1024){ + tempax=1280; + if(VGAVDE==360){ + tempbx=768; + }else if(VGAVDE==375){ + tempbx=800; + }else if(VGAVDE==405){ + tempbx=864; + }else{ + tempbx=1024; + } + } + + HDE=tempax; + VDE=tempbx; + REFIndex=OldREFIndex; /* pop di */ + return; +} + +VOID GetResInfo(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT temp,xres,yres,modeflag1; + if(ModeNo<=0x13){ + temp=(USHORT)*((UCHAR *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ + xres=StResInfo[temp][0]; + yres=StResInfo[temp][1]; + }else{ + temp=(USHORT)*((UCHAR *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + xres=ModeResInfo[temp][0]; /* xres->ax */ + yres=ModeResInfo[temp][1]; /* yres->bx */ + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK){ xres=xres*2;} + if(modeflag1&DoubleScanMode){yres=yres*2;} + } + if(!(LCDResInfo==Panel1024x768)){ + if(yres==400) yres=405; + if(yres==350) yres=360; + if(SetFlag&LCDVESATiming){ + if(yres==360) yres=375; + } + } + VGAHDE=xres; + HDE=xres; + VGAVDE=yres; + VDE=yres; +} + +VOID GetRAMDAC2DATA(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempax,tempbx,tempbh,modeflag1,t1=0,t2; + RVBHCMAX=1;RVBHCFACT=1; + if(ModeNo<=0x13){ + tempax=*((UCHAR *)(ROMAddr+REFIndex+10)); + tempbx=*((USHORT *)(ROMAddr+REFIndex+16)); + }else{ + t1=*((UCHAR *)(ROMAddr+REFIndex+0x2)); /* Ext_CRT1CRTC=2 */ + t1=t1*CRT1Len; + REFIndex=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ + REFIndex=REFIndex+t1; + t1=*((UCHAR *)(ROMAddr+REFIndex+0)); + t2=*((UCHAR *)(ROMAddr+REFIndex+14)); + tempax=(t1&0xFF)|((t2&0x03)<<8); + tempbx=*((USHORT *)(ROMAddr+REFIndex+6)); + t1=*((UCHAR *)(ROMAddr+REFIndex+13)); + t1=(t1&0x01)<<2; + } + + tempbh=tempbx>>8; + tempbh=((tempbh&0x20)>>4)|(tempbh&0x01); + tempbh=tempbh|t1; + tempbx=(tempbx&0xFF)|(tempbh<<8); + tempax=tempax+5; + modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&Charx8Dot){ + tempax=tempax*8; + }else{ + tempax=tempax*9; + } + + VGAHT=tempax; + HT=tempax; + tempbx++; + VGAVT=tempbx; + VT=tempbx; + +} + +VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempcl,tempbx,tempal,tempax; + if(VBInfo&SetCRT2ToLCD){ /* LCD */ + tempbx=LCDResInfo; + tempcl=LCDDataLen; + if(!(SetFlag&LCDVESATiming)) tempbx+=5; + }else if(VBInfo&SetPALTV){ + tempcl=TVDataLen; + tempbx=3; + }else{ + tempbx=4; + tempcl=TVDataLen; + } + + if(SetFlag&TVSimuMode){ + tempbx=tempbx+4; + } + if(ModeNo<=0x13){ + tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + }else{ + tempal=*((UCHAR *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + } + tempal=tempal&0x1F; + + tempax=tempal*tempcl; + REFIndex=*((USHORT *)(ROMAddr + 0x20E + tempbx*2)); + REFIndex+=tempax; +} + +VOID UnLockCRT2(USHORT BaseAddr) +{ + UCHAR temp3; + USHORT Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + temp3=(UCHAR)GetReg1(Part1Port,0x24); + temp3=temp3|0x01; + SetReg1(Part1Port,0x24,(USHORT)temp3); +} + +VOID SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo) +{ + USHORT i,j; + USHORT tempcl,tempah,temp3; + USHORT Part4Port; + USHORT Part1Port; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + for(i=0,j=4;i<3;i++,j++){ + SetReg1(Part1Port,j,0); + } + + tempcl=ModeType; + if(ModeNo>0x13){ + tempcl=tempcl-ModeVGA; + if((tempcl>0)||(tempcl==0)){ + tempah=((0x010>>tempcl)|0x080); + } + }else{ + tempah=0x080; + } + + if(VBInfo&SetInSlaveMode){ + tempah=(tempah^0x0A0); + } + if(VBInfo&CRT2DisplayFlag){ + tempah=0; + } + SetReg1(Part1Port,0,tempah); + + tempah=0x01; + if(!(VBInfo&SetInSlaveMode)){ + tempah=(tempah|0x02); + } + if(!(VBInfo&SetCRT2ToRAMDAC)){ + tempah=(tempah^0x05); + if(!(VBInfo&SetCRT2ToLCD)){ + tempah=(tempah^0x01); + } + } + tempah=(tempah<<5)&0xFF; + if(VBInfo&CRT2DisplayFlag){ + tempah=0; + } + SetReg1(Part1Port,0x01,tempah); + + tempah=tempah>>5; + if((ModeType==ModeVGA)&&(!(VBInfo&SetInSlaveMode))){ + tempah=tempah|0x010; + } + if(LCDResInfo!=Panel1024x768){ + tempah=tempah|0x080; + } + if(VBInfo&SetCRT2ToTV){ + if(VBInfo&SetInSlaveMode){ + tempah=tempah|0x020; + } + } + + temp3=(UCHAR)GetReg1(Part4Port,0x0D); + temp3=temp3&(~0x0BF); + temp3=temp3|tempah; + SetReg1(Part4Port,0x0D,(USHORT)temp3); +} + +VOID SetGroup1(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + USHORT temp1,temp2,tempcl,tempch,tempbl,tempbh,tempal,tempah,tempax,tempbx; + USHORT tempcx,OldREFIndex; + USHORT Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + OldREFIndex=REFIndex; /* push di */ + + SetCRT2Offset(Part1Port,ROMAddr); + SetCRT2FIFO(Part1Port,ROMAddr,ModeNo,pScrn); + SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); + + GetCRT1Ptr(ROMAddr); + + temp1=(VGAHT-1)&0x0FF; /* BTVGA2HT 0x08,0x09 */ + SetReg1(Part1Port,0x08,temp1); + temp1=(((VGAHT-1)&0xFF00)>>8)<<4; + SetRegANDOR(Part1Port,0x09,~0x0F0,temp1); + + temp1=(VGAHDE+12)&0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ + SetReg1(Part1Port,0x0A,temp1); + + temp1=VGAHDE+12; /* bx BTVGA@HRS 0x0B,0x0C */ + temp2=(VGAHT-VGAHDE)>>2; /* cx */ + temp1=temp1+temp2; + temp2=(temp2<<1)+temp1; + tempcl=temp2&0x0FF; + if(VBInfo&SetCRT2ToRAMDAC){ + tempbl=*((UCHAR *)(ROMAddr+REFIndex+4)); /* di+4 */ + tempbh=*((UCHAR *)(ROMAddr+REFIndex+14)); /* di+14 */ + temp1=((tempbh>>6)<<8)|tempbl; /* temp1->bx */ + temp1=(temp1-1)<<3; + tempcl=*((UCHAR *)(ROMAddr+REFIndex+5)); /* di+5 */ + tempch=*((UCHAR *)(ROMAddr+REFIndex+15)); /* di+15 */ + tempcl=tempcl&0x01F; + tempch=(tempch&0x04)<<(6-2); + tempcl=((tempcl|tempch)-1)<<3; + } + SetReg1(Part1Port,0x0B,(USHORT)(temp1&0x0FF)); + tempah=(temp1&0xFF00)>>8; + tempbh=((((VGAHDE+12)&0xFF00)>>8)<<4)&0x0FF; + tempah=tempah|tempbh; + SetReg1(Part1Port,0x0C,tempah); + SetReg1(Part1Port,0x0D,tempcl); /* BTVGA2HRE 0x0D */ + tempcx=(VGAVT-1); + tempah=tempcx&0x0FF; + SetReg1(Part1Port,0x0E,tempah); /* BTVGA2TV 0x0E,0x12 */ + tempbx=VGAVDE-1; + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x0F,tempah); /* BTVGA2VDEE 0x0F,0x12 */ + tempah=((tempbx&0xFF00)<<3)>>8; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part1Port,0x12,tempah); + + tempbx=(VGAVT+VGAVDE)>>1; /* BTVGA2VRS 0x10,0x11 */ + tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /* BTVGA2VRE 0x11 */ + if(VBInfo&SetCRT2ToRAMDAC){ + tempbx=*((UCHAR *)(ROMAddr+REFIndex+8)); /* di+8 */ + temp1=*((UCHAR *)(ROMAddr+REFIndex+7)); /* di+7 */ + if(temp1&0x04){ + tempbx=tempbx|0x0100; + } + if(temp1&0x080){ + tempbx=tempbx|0x0200; + } + temp1=*((UCHAR *)(ROMAddr+REFIndex+13)); /* di+13 */ + if(temp1&0x08){ + tempbx=tempbx|0x0400; + } + tempcl= *((UCHAR *)(ROMAddr+REFIndex+9)); /* di+9 */ + tempcx=(tempcx&0xFF00)|(tempcl&0x00FF); + } + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x10,tempah); + tempbh=(tempbx&0xFF00)>>8; + tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); + SetReg1(Part1Port,0x11,tempah); + + if( pSiS->Chipset == PCI_CHIP_SIS300 ){ + tempah=0x10; + if((LCDResInfo!=Panel1024x768)&&(LCDResInfo==Panel1280x1024)){ + tempah=0x20; + } + }else{ + tempah=0x20; + } + if(VBInfo&SetCRT2ToTV){ + tempah=0x08; + } + + SetRegANDOR(Part1Port,0x13,~0x03C,tempah); + + if(!(VBInfo&SetInSlaveMode)){ + REFIndex=OldREFIndex; + return; + } + if(VBInfo&SetCRT2ToTV){ + tempax=0xFFFF; + }else{ + tempax=GetVGAHT2(); + } + tempcl=0x08; /* Reg 0x03 Horozontal Total */ + temp1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(temp1&Charx8Dot)){ /* temp1->St_ModeFlag */ + tempcl=0x09; + } + if(tempax>=VGAHT){ + tempax=VGAHT; + } + if(temp1&HalfDCLK){ + tempax=tempax>>1; + } + tempax=(tempax/tempcl)-5; + tempbl=tempax; + tempah=0xFF; /* set MAX HT */ + SetReg1(Part1Port,0x03,tempah); + + tempax=VGAHDE; /* 0x04 Horizontal Display End */ + if(temp1&HalfDCLK){ + tempax=tempax>>1; + } + tempax=(tempax/tempcl)-1; + tempbh=tempax; + SetReg1(Part1Port,0x04,tempax); + + tempah=tempbh; + if(VBInfo&SetCRT2ToTV){ + tempah=tempah+2; + } + SetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ + SetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ + /* 0x07 horizontal Retrace Start */ + tempcx=(tempbl+tempbh)>>1; + tempah=(tempcx&0xFF)+2; + + if(VBInfo&SetCRT2ToTV){ + tempah=tempah-1; + if(!(temp1&HalfDCLK)){ + if((temp1&Charx8Dot)){ + tempah=tempah+4; + if(VGAHDE>=800){ + tempah=tempah-6; + } + } + } + }else{ + if(!(temp1&HalfDCLK)){ + tempah=tempah-4; + if(VGAHDE>=800){ + tempah=tempah-7; + if(ModeType==ModeEGA){ + if(VGAVDE==1024){ + tempah=tempah+15; + if(LCDResInfo!=Panel1280x1024){ + tempah=tempah+7; + } + } + } + if(VGAHDE>=1280){ + tempah=tempah+28; + } + } + } + } + + SetReg1(Part1Port,0x07,tempah); /* 0x07 Horizontal Retrace Start */ + + SetReg1(Part1Port,0x08,0); /* 0x08 Horizontal Retrace End */ + SetReg1(Part1Port,0x18,0x03); /* 0x18 SR08 */ + SetReg1(Part1Port,0x19,0); /* 0x19 SR0C */ + SetReg1(Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ + + tempcx=0x121; + tempcl=0x21; + tempch=0x01; + tempbx=VGAVDE; /* 0x0E Virtical Display End */ + if(tempbx==360) tempbx=350; + if(tempbx==375) tempbx=350; + if(tempbx==405) tempbx=400; + tempbx--; + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x0E,tempah); + SetReg1(Part1Port,0x10,tempah); /* 0x10 vertical Blank Start */ + tempbh=(tempbx&0xFF00)>>8; + if(tempbh&0x01){ + tempcl=tempcl|0x0A; + } + tempah=0;tempal=0x0B; + if(temp1&DoubleScanMode){ + tempah=tempah|0x080; + } + if(tempbh&0x02){ + tempcl=tempcl|0x040; + tempah=tempah|0x020; + } + SetReg1(Part1Port,0x0B,tempah); + if(tempbh&0x04){ + tempch=tempch|0x06; + } + + SetReg1(Part1Port,0x11,0); /* 0x11 Vertival Blank End */ + + tempax=VGAVT-tempbx; /* 0x0C Vertical Retrace Start */ + tempax=tempax>>2; + temp2=tempax; /* push ax */ + tempax=tempax<<1; + tempbx=tempax+tempbx; + if((SetFlag&TVSimuMode)&&(VBInfo&SetPALTV)&&(VGAHDE==800)){ + tempbx=tempbx+40; + } + tempah=(tempbx&0x0FF); + SetReg1(Part1Port,0x0C,tempah); + tempbh=(tempbx&0xFF00)>>8; + if(tempbh&0x01){ + tempcl=tempcl|0x04; + } + if(tempbh&0x02){ + tempcl=tempcl|0x080; + } + if(tempbh&0x04){ + tempch=tempch|0x08; + } + + tempax=temp2; /* pop ax */ + tempax=(tempax>>2)+1; + tempbx=tempbx+tempax; + tempah=(tempbx&0x0FF)&0x0F; + SetReg1(Part1Port,0x0D,tempah); /* 0x0D vertical Retrace End */ + tempbl=tempbx&0x0FF; + if(tempbl&0x10){ + tempch=tempch|0x020; + } + + tempah=tempcl; + SetReg1(Part1Port,0x0A,tempah); /* 0x0A CR07 */ + tempah=tempch; + SetReg1(Part1Port,0x17,tempah); /* 0x17 SR0A */ + tempax=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempah=(tempax&0xFF00)>>8; + tempah=(tempah>>1)&0x09; + SetReg1(Part1Port,0x16,tempah); /* 0x16 SR01 */ + SetReg1(Part1Port,0x0F,0); /* 0x0F CR14 */ + SetReg1(Part1Port,0x12,0); /* 0x12 CR17 */ + SetReg1(Part1Port,0x1A,0); /* 0x1A SR0E */ + + REFIndex=OldREFIndex; /* pop di */ +} + +VOID SetCRT2Offset(USHORT Part1Port,ULONG ROMAddr) +{ + USHORT offset; + if(VBInfo&SetInSlaveMode){ + return; + } + offset=GetOffset(ROMAddr); + SetReg1(Part1Port,0x07,(USHORT)(offset&0xFF)); + SetReg1(Part1Port,0x09,(USHORT)((offset&0xFF00)>>8)); + SetReg1(Part1Port,0x03,(USHORT)(((offset>>3)&0xFF)+1)); +} + +USHORT GetOffset(ULONG ROMAddr) +{ + USHORT tempal,temp1,colordepth; + tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ + tempal=(tempal>>4)&0xFF; + ScreenOffset=*((USHORT *)(ROMAddr+0x206)); /* Get ScreeOffset table */ + tempal=*((UCHAR *)(ROMAddr+ScreenOffset+tempal)); /* get ScreenOffset */ + tempal=tempal&0xFF; + temp1=*((UCHAR *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ + if(temp1&InterlaceMode){ + tempal=tempal<<1; + } + colordepth=GetColorDepth(ROMAddr); + return(tempal*colordepth); +} + +USHORT GetColorDepth(ULONG ROMAddr) +{ + USHORT ColorDepth[6]={1,2,4,4,6,8}; + USHORT temp; + int temp1; + temp=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + temp1=(temp&ModeInfoFlag)-ModeEGA; + if(temp1<0) temp1=0; + return(ColorDepth[temp1]); +} + +VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + USHORT temp,temp1,temp2,temp3,flag; + USHORT vclk2ptr,latencyindex; + USHORT oldREFIndex,CRT1ModeNo,oldModeIDOffset; + long int longtemp; + + 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 */ + 73, 65, 63, 57, 55, 00, /* 64 bit BQ=2 */ + 00, 64, 62, 56, 54, 34, /* 64 bit BQ=1 */ + 78, 70, 68, 62, 60, 00, /* 128 bit BQ=2 */ + 00, 62, 60, 54, 52, 34}; /* 128 bit BQ=1 */ + + oldREFIndex=REFIndex; /* push REFIndex(CRT2 now) */ + oldModeIDOffset=ModeIDOffset; /* push ModeIDOffset */ + + CRT1ModeNo=(UCHAR)GetReg1(P3d4,0x34); /* get CRT1 ModeNo */ + SearchModeID(ROMAddr,CRT1ModeNo); /* Get ModeID Table */ + + GetRatePtr(ROMAddr,CRT1ModeNo); /* Set REFIndex-> for crt1 refreshrate */ + temp1=GetVCLK(ROMAddr,CRT1ModeNo); + temp2=GetColorTh(ROMAddr); + temp3=GetMCLK(ROMAddr); + temp=((USHORT)(temp1*temp2)/temp3); /* temp->bx */ + temp1=(UCHAR)GetReg1(P3c4,0x14); /* SR_14 */ + temp1=temp1>>6; + temp1=temp1<<1; + if(temp1==0) temp1=1; + temp1=temp1<<2; /* temp1->ax */ + + longtemp=temp1-temp; + + temp2=(USHORT)((28*16)/(int)longtemp); /* temp2->cx */ + if(!((temp2*(int)longtemp)==(28*16))) temp2++; + + if( pSiS->Chipset == PCI_CHIP_SIS300 ){ + temp1=CalcDelayVB(); + }else{ /* for Trojan and Spartan */ + flag=(UCHAR)GetReg1(P3c4,0x14); /* SR_14 */ + if(flag&0x80){ + latencyindex=12; /* 128 bit */ + }else{ + latencyindex=0; /* 64 bit */ + } + flag=GetQueueConfig(); + if(!(flag&0x01)){ + latencyindex+=24; /* GUI timing =0 */ + } + if(flag&0x10){ + latencyindex+=6; /* BQ =2 */ + } + latencyindex=latencyindex + (flag>>5); + temp1= LatencyFactor[latencyindex]; + temp1=temp1+15; + flag=(UCHAR)GetReg1(P3c4,0x14); /* SR_14 */ + if(!(flag&0x80)){ + temp1=temp1+5; /* 64 bit */ + } + } + + temp2=temp2+temp1; + REFIndex=oldREFIndex; /* pop REFIndex(CRT2) */ + ModeIDOffset=oldModeIDOffset; /* pop ModeIDOffset */ + + vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); + temp1=*((USHORT *)(ROMAddr+vclk2ptr+(VCLKLen-2))); + temp3=GetColorTh(ROMAddr); + longtemp=temp1*temp2*temp3; + temp3=GetMCLK(ROMAddr); + temp3=temp3<<4; + temp2=(int)(longtemp/temp3); + if((long int)temp2*(long int)temp3<(long int)longtemp) + temp2++; /* temp2->cx */ + + temp1=(UCHAR)GetReg1(Part1Port,0x01); /* part1port index 01 */ + temp1=(temp1&(~0x1F))|0x16; + SetReg1(Part1Port,0x01,temp1); + + if(temp2<=6) temp2=6; + if(temp2>0x14) temp2=0x14; + temp1=(UCHAR)GetReg1(Part1Port,0x02); /* part1port index 02 */ + temp1=(temp1&(~0x1F))|temp2; + SetReg1(Part1Port,0x02,temp1); +} + +USHORT GetVCLK(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempptr; + USHORT temp1; + tempptr=GetVCLKPtr(ROMAddr,ModeNo); + temp1=*((USHORT *)(ROMAddr+tempptr+(VCLKLen-2))); + return temp1; +} + +USHORT GetQueueConfig() +{ + USHORT tempal,tempbl; + ULONG tempeax; + + SetReg4(0xcf8,0x80000050); + tempeax=GetReg3(0xcfc); + tempeax=(tempeax>>24)&0x0f; + tempbl=(USHORT)tempeax; + tempbl=tempbl<<4; + + SetReg4(0xcf8,0x800000A0); + tempeax=GetReg3(0xcfc); + tempeax=(tempeax>>24)&0x0f; + tempal=(USHORT)tempeax; + tempbl=tempbl|tempal; + + return(tempbl); +} + +USHORT GetVCLKPtr(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempal; + tempal=(UCHAR)GetReg2((USHORT)(P3ca+0x02)); /* Port 3cch */ + tempal=((tempal>>2)&0x03); + if(ModeNo>0x13){ + tempal=*((UCHAR *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + } + VCLKLen=GetVCLKLen(ROMAddr); + tempal=tempal*VCLKLen; + tempal=tempal+(*((USHORT *)(ROMAddr+0x208))); /* VCLKData */ + return ((USHORT)tempal); +} + +USHORT GetColorTh(ULONG ROMAddr) +{ + USHORT temp; + temp=GetColorDepth(ROMAddr); + temp=temp>>1; + if(temp==0) temp++; + return temp; +} + +USHORT GetMCLK(ULONG ROMAddr) +{ + USHORT tempmclkptr; + USHORT tempmclk; + tempmclkptr=GetMCLKPtr(ROMAddr); + tempmclk=*((USHORT *)(ROMAddr+tempmclkptr+0x03)); /* di+3 */ + return tempmclk; +} + +USHORT GetMCLKPtr(ULONG ROMAddr) +{ + USHORT tempdi; + USHORT tempdramtype,tempax; + + tempdi=*((USHORT *)(ROMAddr+0x20C)); /* MCLKData */ + tempdramtype=GetDRAMType(ROMAddr); + tempax=5*tempdramtype; + tempdi=tempdi+tempax; + return (tempdi); +} + +USHORT GetDRAMType(ULONG ROMAddr) +{ + USHORT tsoftsetting,temp3; + tsoftsetting=*((UCHAR *)(ROMAddr+0x52)); + if(!(tsoftsetting&SoftDramType)){ + temp3=(UCHAR)GetReg1(P3c4,0x3A); + tsoftsetting=temp3; + } + tsoftsetting=tsoftsetting&0x07; + return(tsoftsetting); +} + +USHORT CalcDelayVB() +{ + USHORT tempal,tempah,temp1,tempbx; + USHORT ThTiming[8]={1,2,2,3,0,1,1,2}; + USHORT ThLowB[24]={81,4,72,6,88,8,120,12, + 55,4,54,6,66,8,90,12, + 42,4,45,6,55,8,75,12}; + + tempah=(UCHAR)GetReg1(P3c4,0x18); /* SR_18 */ + tempah=tempah&0x62; + tempah=tempah>>1; + tempal=tempah; + tempah=tempah>>3; + tempal=tempal|tempah; + tempal=tempal&0x07; + + temp1=ThTiming[tempal]; /* temp1->cl */ + + tempbx=(UCHAR)GetReg1(P3c4,0x16); /* SR_16 */ + tempbx=tempbx>>6; + tempah=(UCHAR)GetReg1(P3c4,0x14); /* SR_14 */ + tempah=((tempah>>4)&0x0C); + tempbx=((tempbx|tempah)<<1); + + tempal=ThLowB[tempbx+1]*temp1; + tempbx=ThLowB[tempbx]; + tempbx=tempal+tempbx; + + return(tempbx); +} + +USHORT GetVCLK2Ptr(ULONG ROMAddr,USHORT ModeNo) +{ + USHORT tempal; + USHORT LCDXlat1VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; + USHORT LCDXlat2VCLK[4]={VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2}; + + if(ModeNo<=0x13){ + tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + }else{ + tempal=*((UCHAR *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ + } + tempal=tempal>>6; + if(LCDResInfo!=Panel1024x768){ + tempal=LCDXlat2VCLK[tempal]; + }else{ + tempal=LCDXlat1VCLK[tempal]; + } + + if(VBInfo&SetCRT2ToLCD){ + tempal=tempal; + }else if(VBInfo&SetCRT2ToTV){ + if(SetFlag&RPLLDIV2XO){ + tempal=TVVCLKDIV2; + }else{ + tempal=TVVCLK; + } + }else{ + tempal=(UCHAR)GetReg2((USHORT)(P3ca+0x02)); /* Port 3cch */ + tempal=((tempal>>2)&0x03); + if(ModeNo>0x13){ + tempal=*((UCHAR *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + } + } + VCLKLen=GetVCLKLen(ROMAddr); + tempal=tempal*VCLKLen; + tempal=tempal+(*((USHORT *)(ROMAddr+0x208))); /* VCLKData */ + return ((USHORT)tempal); +} + +USHORT GetVCLKLen(ULONG ROMAddr) +{ + USHORT VCLKDataStart,vclklabel,temp; + VCLKDataStart=*((USHORT *)(ROMAddr+0x208)); + for(temp=0;;temp++){ + vclklabel=*((USHORT *)(ROMAddr+VCLKDataStart+temp)); + if(vclklabel==VCLKStartFreq){ + temp=temp+2; + return(temp); + } + } + return(0); +} + + +VOID SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) +{ + USHORT temp1,tempah; + USHORT temp; + USHORT Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + temp=*((USHORT *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ + tempah=(temp>>8)&0x0C0; + temp1=(UCHAR)GetReg1(Part1Port,0x19); /* part1port index 02 */ + temp1=(temp1&(~0x0C0))|tempah; + SetReg1(Part1Port,0x19,temp1); +} + +VOID GetCRT1Ptr(ULONG ROMAddr) +{ + USHORT temprefcrt1; + USHORT temp; + temp=*((UCHAR *)(ROMAddr+REFIndex+0x02)); /* di+Ext_CRT1CRTC */ + temp=temp*CRT1Len; + temprefcrt1=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ + REFIndex=temprefcrt1+temp; /* di->CRT1Table+Ext_CRT1CRTC*CRT1Len */ +} + +VOID SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR) +{ + USHORT temp1; + temp1=GetReg1(Port,Index); /* part1port index 02 */ + temp1=(temp1&(DataAND))|DataOR; + SetReg1(Port,Index,temp1); +} + +USHORT GetVGAHT2() +{ + long int temp1,temp2; + temp1=(VGAVT-VGAVDE)*RVBHCMAX; + temp1=temp1&0x0FFFF; + temp2=(VT-VDE)*RVBHCFACT; + temp2=temp2&0x0FFFF; + temp2=temp2*HT; + temp2=temp2/temp1; + return((USHORT)temp2); +} + +VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr) +{ + USHORT tempah,tempbl,tempbh,tempcl,i,j,tempcx,pushcx,tempbx,tempax; + USHORT tempmodeflag,tempflowflag; + UCHAR *temp1; + USHORT *temp2; + USHORT pushbx; + USHORT Part2Port; + long int longtemp; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + tempcx=VBInfo; + tempah=VBInfo&0x0FF; + tempbl=VBInfo&0x0FF; + tempbh=VBInfo&0x0FF; + tempbx=(tempbl&0xFF)|(tempbh<<8); + tempbl=tempbl&0x10; + tempbh=(tempbh&0x04)<<1; + tempah=(tempah&0x08)>>1; + tempah=tempah|tempbh; + tempbl=tempbl>>3; + tempah=tempah|tempbl; + tempah=tempah^0x0C; + + if(VBInfo&SetPALTV){ + temp1=(UCHAR *)(ROMAddr+0x0F1); /* PALPhase */ + temp2=PALTiming; + }else{ + tempah=tempah|0x10; + temp1=(UCHAR *)(ROMAddr+0x0ED); /* NTSCPhase */ + temp2=NTSCTiming; + } + + SetReg1(Part2Port,0x0,tempah); + for(i=0x31;i<=0x34;i++,temp1++){ + SetReg1(Part2Port,i,*(UCHAR *)temp1); + } + for(i=0x01,j=0;i<=0x2D;i++,j++){ + SetReg1(Part2Port,i,temp2[j]); + } + for(i=0x39;i<=0x45;i++,j++){ + SetReg1(Part2Port,i,temp2[j]); /* di->temp2[j] */ + } + + tempah=GetReg1(Part2Port,0x0A); + tempah=tempah|NewFlickerMode; + SetReg1(Part2Port,0x0A,tempah); + + SetReg1(Part2Port,0x35,RY1COE); + SetReg1(Part2Port,0x36,RY2COE); + SetReg1(Part2Port,0x37,RY3COE); + SetReg1(Part2Port,0x38,RY4COE); + + tempcx=HT-1; + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x1B,tempah); + tempah=(tempcx&0xFF00)>>8; + SetRegANDOR(Part2Port,0x1D,~0x0F,(UCHAR)tempah); + + tempcx=HT>>1; + pushcx=tempcx; /* push cx */ + + tempcx=tempcx+7; + tempah=(tempcx&0xFF); + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x22,~0x0F0,tempah); + + + tempbx=temp2[j]; + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x24,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x25,~0x0F0,tempah); + + tempbx=tempbx+8; + + tempah=((tempbx&0xFF)<<4)&0xFF; + SetRegANDOR(Part2Port,0x29,~0x0F0,tempah); + + tempcx=tempcx+temp2[++j]; + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x27,tempah); + tempah=(((tempcx&0xFF00)>>8)<<4)&0xFF; + SetRegANDOR(Part2Port,0x28,~0x0F0,tempah); + + tempcx=tempcx+8; + + tempah=tempcx&0xFF; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2A,~0x0F0,tempah); + + tempcx=pushcx; /* pop cx */ + tempcx=tempcx-temp2[++j]; + tempah=tempcx&0xFF; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2D,~0x0F0,tempah); + + tempcx=tempcx-11; + if(!(VBInfo&SetCRT2ToTV)){ + tempax=GetVGAHT2(); + tempcx=tempax-1; + } + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x2E,tempah); + + tempbx=VDE; + if(VGAVDE==360){ + tempbx=746; + } + if(VGAVDE==375){ + tempbx=746; + } + if(VGAVDE==405){ + tempbx=853; + } + /* assuming <<ifndef>> HivisionTV */ + if((VBInfo&SetCRT2ToTV)){ + tempbx=tempbx>>1; + } + + tempbx=tempbx-2; + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x2F,tempah); + + tempah=(tempcx&0xFF00)>>8; + tempbh=(tempbx&0xFF00)>>8; + tempbh=(tempbh<<6)&0xFF; + tempah=tempah|tempbh; + /* assuming <<ifndef>> hivisiontv */ + tempah=tempah|0x10; + if(!(VBInfo&SetCRT2ToSVIDEO)){ + tempah=tempah|0x20; + } + + SetReg1(Part2Port,0x30,tempah); + + tempbh=0; + tempbx=tempbx&0xFF; + + tempmodeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempflowflag=0; + if(!(tempmodeflag&HalfDCLK)){ + tempcx=VGAHDE; + if(tempcx>=HDE){ + tempbh=tempbh|0x20; + tempbx=(tempbh<<8)|(tempbx&0xFF); + tempah=0; + } + } + /* assuming ifdef hivisiontv */ + tempcx=0x0101; + if(!(tempbh&0x20)){ + if(tempmodeflag&HalfDCLK){ + tempcl=((tempcx&0xFF)<<1)&0xFF; + tempcx=(tempcx&0xFF00)|tempcl; + } + pushbx=tempbx; + tempax=VGAHDE; + tempbx=(tempcx&0xFF00)>>8; + longtemp=tempax*tempbx; + tempcx=tempcx&0xFF; + longtemp=longtemp/tempcx; + longtemp=longtemp*8*1024; + tempax=(longtemp)/HDE; + if(tempax*HDE<longtemp){ + tempax=tempax+1; + }else{ + tempax=tempax; + } + tempbx=pushbx; + tempah=((tempax&0xFF00)>>8)&0x01F; + tempbh=tempbh|tempah; + tempah=tempax&0xFF; + } + + SetReg1(Part2Port,0x44,tempah); + tempah=tempbh; + SetRegANDOR(Part2Port,0x45,~0x03F,tempah); + + if(VBInfo&SetCRT2ToTV){ + return; + } + tempah=0x01; + if(LCDResInfo==Panel1280x1024){ + if(ModeType==ModeEGA){ + if(VGAHDE>=1024){ + tempah=0x02; + } + } + } + SetReg1(Part2Port,0x0B,tempah); + + tempbx=HDE-1; /* RHACTE=HDE-1 */ + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x2C,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2B,~0x0F0,tempah); + + tempbx=VDE-1; /* RTVACTEO=(VDE-1)&0xFF */ + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x03,tempah); + tempah=((tempbx&0xFF00)>>8)&0x07; + SetRegANDOR(Part2Port,0x0C,~0x07,tempah); + + tempcx=VT-1; + tempah=tempcx&0xFF; /* RVTVT=VT-1 */ + SetReg1(Part2Port,0x19,tempah); + tempah=(tempcx&0xFF00)>>8; + tempah=(tempah<<5)&0xFF; + if(LCDInfo&LCDRGB18Bit){ + tempah=tempah|0x10; + } + SetReg1(Part2Port,0x1A,tempah); + + tempcx++; + if(LCDResInfo==Panel1024x768){ + tempbx=768; + }else{ + tempbx=1024; + } + + if(tempbx==VDE){ + tempax=1; + }else{ + tempax=tempbx; + tempax=(tempax-VDE)>>1; + } + tempcx=tempcx-tempax; /* lcdvdes */ + tempbx=tempbx-tempax; /* lcdvdee */ + + tempah=tempcx&0xFF; /* RVEQ1EQ=lcdvdes */ + SetReg1(Part2Port,0x05,tempah); + tempah=tempbx&0xFF; /* RVEQ2EQ=lcdvdee */ + SetReg1(Part2Port,0x06,tempah); + + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<3)&0xFF; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part2Port,0x02,tempah); + + tempcx=(VT-VDE)>>4; /* (VT-VDE)>>4 */ + tempbx=(VT+VDE)>>1; + tempah=tempbx&0xFF; /* RTVACTEE=lcdvrs */ + SetReg1(Part2Port,0x04,tempah); + + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + tempbx=tempbx+tempcx+1; + tempbl=(tempbx&0x0F); + tempah=tempah|tempbl; /* RTVACTSO=lcdvrs&0x700>>4+lcdvre */ + SetReg1(Part2Port,0x01,tempah); + + tempah=GetReg1(Part2Port,0x09); + tempah=tempah&0xF0; + SetReg1(Part2Port,0x09,tempah); + + tempah=GetReg1(Part2Port,0x0A); + tempah=tempah&0xF0; + SetReg1(Part2Port,0x0A,tempah); + + tempcx=(HT-HDE)>>2; /* (HT-HDE)>>2 */ + tempbx=(HDE+7); /* lcdhdee */ + tempah=tempbx&0xFF; /* RHEQPLE=lcdhdee */ + SetReg1(Part2Port,0x23,tempah); + tempah=(tempbx&0xFF00)>>8; + SetRegANDOR(Part2Port,0x25,~0x0F,tempah); + + SetReg1(Part2Port,0x1F,0x07); /* RHBLKE=lcdhdes */ + tempah=GetReg1(Part2Port,0x20); + tempah=tempah&0x0F; + SetReg1(Part2Port,0x20,tempah); + + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; /* RHBURSTS=lcdhrs */ + SetReg1(Part2Port,0x1C,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x1D,~0x0F0,tempah); + + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; /* RHSYEXP2S=lcdhre */ + SetReg1(Part2Port,0x21,tempah); + + tempah=GetReg1(Part2Port,0x17); + tempah=tempah&0xFB; + SetReg1(Part2Port,0x17,tempah); + + tempah=GetReg1(Part2Port,0x18); + tempah=tempah&0xDF; + SetReg1(Part2Port,0x18,tempah); + return; +} + +VOID SetGroup3(USHORT BaseAddr) +{ + USHORT i; + USHORT *tempdi; + USHORT Part3Port; + Part3Port=BaseAddr+IND_SIS_CRT2_PORT_12; + if(VBInfo&SetPALTV){ + tempdi=PALGroup3Data; + }else{ + tempdi=NTSCGroup3Data; + } + for(i=0;i<=0x3E;i++){ + SetReg1(Part3Port,i,tempdi[i]); + } + return; +} + +VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) +{ + USHORT Part4Port; + USHORT tempax,tempah,tempcx,tempbx,tempbh,tempch,tempmodeflag; + long int tempebx,tempeax,templong; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + + tempax=0x0c; + if(VBInfo&SetCRT2ToTV){ + if(VBInfo&SetInSlaveMode){ + if(!(SetFlag&TVSimuMode)){ + SetFlag=SetFlag|RPLLDIV2XO; + tempax=tempax|0x04000; + } + }else{ + SetFlag=SetFlag|RPLLDIV2XO; + tempax=tempax|0x04000; + } + } + + if(LCDResInfo!=Panel1024x768){ + tempax=tempax|0x08000; + } + tempah=(tempax&0xFF00)>>8; + SetReg1(Part4Port,0x0C,tempah); + + tempah=RVBHCFACT; + SetReg1(Part4Port,0x13,tempah); + + tempbx=RVBHCMAX; + tempah=tempbx&0xFF; + SetReg1(Part4Port,0x14,tempah); + tempbh=(((tempbx&0xFF00)>>8)<<7)&0xFF; + + tempcx=VGAHT-1; + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x16,tempah); + tempch=(((tempcx&0xFF00)>>8)<<3)&0xFF; + tempbh=tempbh|tempch; + + tempcx=VGAVT-1; + if(!(VBInfo&SetCRT2ToTV)){ + tempcx=tempcx-5; + } + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x17,tempah); + tempbh=tempbh|((tempcx&0xFF00)>>8); + tempah=tempbh; + SetReg1(Part4Port,0x15,tempah); + + tempcx=VBInfo; + tempbx=VGAHDE; + tempmodeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(tempmodeflag&HalfDCLK){ + tempbx=tempbx>>1; + } + + if(VBInfo&SetCRT2ToLCD){ + tempah=0; + if(tempbx>800){ + tempah=0x60; + } + }else{ + tempah=0x080; + } + if(LCDResInfo!=Panel1280x1024){ + tempah=tempah|0x0A; + } + + SetRegANDOR(Part4Port,0x0E,~0xEF,tempah); + + tempebx=VDE; + + tempcx=RVBHRS; + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x18,tempah); + + tempeax=VGAVDE; + tempcx=tempcx|0x04000; + tempeax=tempeax-tempebx; + if(tempeax<0){ + tempcx=tempcx^(0x04000); + tempeax=VGAVDE; + } + + templong=(tempeax*256*1024)/tempebx; + if(tempeax*256*1024-templong*tempebx>0){ + tempebx=templong+1; + }else{ + tempebx=templong; + } + + + tempah=tempebx&0xFF; + SetReg1(Part4Port,0x1B,tempah); + tempah=(tempebx&0xFF00)>>8; + SetReg1(Part4Port,0x1A,tempah); + tempebx=tempebx>>16; + tempah=tempebx&0xFF; + tempah=(tempah<<4)&0xFF; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part4Port,0x19,tempah); + + SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo); +} + +VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) +{ + USHORT vclk2ptr; + USHORT tempah,temp1; + USHORT Part4Port; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); + SetReg1(Part4Port,0x0A,0x01); + tempah=*((UCHAR *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ + SetReg1(Part4Port,0x0B,tempah); + tempah=*((UCHAR *)(ROMAddr+vclk2ptr+0x00)); /* di */ + SetReg1(Part4Port,0x0A,tempah); + SetReg1(Part4Port,0x12,0x00); + tempah=0x08; + if(VBInfo&SetCRT2ToRAMDAC){ + tempah=tempah|0x020; + } + temp1=GetReg1(Part4Port,0x12); + tempah=tempah|temp1; + SetReg1(Part4Port,0x12,tempah); +} + +VOID SetGroup5(USHORT BaseAddr,ULONG ROMAddr) +{ + USHORT Part5Port; + USHORT Pindex,Pdata; + Part5Port=BaseAddr+IND_SIS_CRT2_PORT_14+2; + Pindex=Part5Port; + Pdata=Part5Port+1; + if(ModeType==ModeVGA){ + if(!(VBInfo&(SetInSlaveMode|LoadDACFlag|CRT2DisplayFlag))){ + EnableCRT2(); + LoadDAC2(ROMAddr,Part5Port); + } + } + return; +} + +VOID EnableCRT2() +{ + USHORT temp1; + temp1=GetReg1(P3c4,0x1E); + temp1=temp1|0x20; + SetReg1(P3c4,0x1E,temp1); /* SR 1E */ +} + +VOID LoadDAC2(ULONG ROMAddr,USHORT Part5Port) +{ + USHORT data,data2; + USHORT time,i,j,k; + USHORT m,n,o; + USHORT si,di,bx,dl; + USHORT al,ah,dh; + USHORT *table=0; + USHORT Pindex,Pdata; + Pindex=Part5Port; + Pdata=Part5Port+1; + data=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); + data=data&DACInfoFlag; + time=64; + if(data==0x00) table=MDA_DAC; + if(data==0x08) table=CGA_DAC; + if(data==0x10) table=EGA_DAC; + if(data==0x18) { + time=256; + table=VGA_DAC; + } + if(time==256) j=16; + else j=time; + + SetReg3(Pindex,0x00); + + for(i=0;i<j;i++) { + data=table[i]; + for(k=0;k<3;k++) { + data2=0; + if(data&0x01) data2=0x2A; + if(data&0x02) data2=data2+0x15; + SetReg3(Pdata,data2); + data=data>>2; + } + } + + if(time==256) { + for(i=16;i<32;i++) { + data=table[i]; + for(k=0;k<3;k++) SetReg3(Pdata,data); + } + si=32; + for(m=0;m<9;m++) { + di=si; + bx=si+0x04; + dl=0; + for(n=0;n<3;n++) { + for(o=0;o<5;o++) { + dh=table[si]; + ah=table[di]; + al=table[bx]; + si++; + WriteDAC2(Pdata,dl,ah,al,dh); + } /* for 5 */ + si=si-2; + for(o=0;o<3;o++) { + dh=table[bx]; + ah=table[di]; + al=table[si]; + si--; + WriteDAC2(Pdata,dl,ah,al,dh); + } /* for 3 */ + dl++; + } /* for 3 */ + si=si+5; + } /* for 9 */ + } +} + +VOID WriteDAC2(USHORT Pdata,USHORT dl, USHORT ah, USHORT al, USHORT dh) +{ + USHORT temp; + USHORT bh,bl; + + bh=ah; + bl=al; + if(dl!=0) { + temp=bh; + bh=dh; + dh=temp; + if(dl==1) { + temp=bl; + bl=dh; + dh=temp; + } + else { + temp=bl; + bl=bh; + bh=temp; + } + } + SetReg3(Pdata,(USHORT)dh); + SetReg3(Pdata,(USHORT)bh); + SetReg3(Pdata,(USHORT)bl); +} + +VOID LockCRT2(USHORT BaseAddr) +{ + USHORT Part1Port; + USHORT Part4Port; + USHORT temp1; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + temp1=GetReg1(Part1Port,0x24); + temp1=temp1&0xFE; + SetReg1(Part1Port,0x24,temp1); +} + +VOID SetLockRegs() +{ + USHORT temp1; + + if((VBInfo&SetInSlaveMode)&&(!(VBInfo&SetCRT2ToRAMDAC))){ + VBLongWait(); + temp1=GetReg1(P3c4,0x32); + temp1=temp1|0x20; + SetReg1(P3c4,0x32,temp1); + VBLongWait(); + } +} + +VOID EnableBridge(USHORT BaseAddr) +{ + USHORT part2_02,part2_05; + USHORT Part2Port; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + + part2_02=(UCHAR)GetReg1(Part2Port,0x02); + part2_05=(UCHAR)GetReg1(Part2Port,0x05); + SetReg1(Part2Port,0x02,0x38); + SetReg1(Part2Port,0x05,0xFF); + LongWait(); + SetRegANDOR(Part2Port,0x00,~0x0E0,0x020); + WaitVBRetrace(BaseAddr); + SetReg1(Part2Port,0x02,part2_02); + SetReg1(Part2Port,0x05,part2_05); +} + +VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr) +{ + USHORT flag1,tempbx,tempbl,tempbh,tempah; + + SetFlag=0; + tempbx=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempbl=tempbx&ModeInfoFlag; + ModeType=tempbl; + tempbx=0; + flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + if(!(flag1&0x20)){ + VBInfo=CRT2DisplayFlag; + return; + } + tempbl=GetReg1(P3d4,0x30); + tempbh=GetReg1(P3d4,0x31); + if(!(tempbl&0x07C)){ + VBInfo=CRT2DisplayFlag; + return; + } + if(tempbl&SetCRT2ToRAMDAC){ + tempbl=tempbl&(SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); + }else if(tempbl&SetCRT2ToLCD){ + tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + }else if(tempbl&SetCRT2ToSCART){ + tempbl=tempbl&(SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); + }else if(tempbl&SetCRT2ToHiVisionTV){ + tempbl=tempbl&(SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode); + } + tempah=GetReg1(P3d4,0x31); + if(tempah&(CRT2DisplayFlag>>8)){ + if(!(tempbl&(SwitchToCRT2|SetSimuScanMode))){ + tempbx=SetSimuScanMode|CRT2DisplayFlag; + tempbh=((tempbx&0xFF00)>>8); + tempbl=tempbx&0xFF; + } + } + if(!(tempbh&(DriverMode>>8))){ + tempbl=tempbl|SetSimuScanMode; + } + VBInfo=tempbl|(tempbh<<8); + if(!(VBInfo&SetSimuScanMode)){ + if(!(VBInfo&SwitchToCRT2)){ + if(BridgeIsEnable(BaseAddr)){ + if(BridgeInSlave()){ + VBInfo=VBInfo|SetSimuScanMode; + } + } + } + } + if(!((VBInfo&(SetSimuScanMode|SwitchToCRT2)))){ + return; + } + if(!(VBInfo&DriverMode)){ + VBInfo=VBInfo|SetInSlaveMode; + return; + } + flag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(flag1&(CRT2Mode|CRT2DisplayFlag))){ + VBInfo=VBInfo|SetInSlaveMode; + } +} + +BOOLEAN BridgeIsEnable(USHORT BaseAddr) +{ + USHORT flag1; + USHORT Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + if(!(flag1&0x20)){ return 0;} + flag1=GetReg1(Part1Port,0x0); + if(flag1&0x0a0){ + return 1; + }else{ + return 0; + } +} + +BOOLEAN BridgeInSlave() +{ + USHORT flag1; + flag1=GetReg1(P3d4,0x31); + if(flag1&(SetInSlaveMode>>8)){ + return 1; + }else{ + return 0; + } +} + +BOOLEAN GetLCDResInfo(USHORT P3d4) +{ + USHORT tempah,tempbh; + + tempah=(UCHAR)GetReg1(P3d4,0x36); + tempbh=tempah; + tempah=tempah&0x0F; + if(tempah!=0) tempah--; + if(tempah>Panel1280x1024) tempah=0; + LCDResInfo=tempah; + tempbh=tempbh>>4; + LCDTypeInfo=tempbh; + + tempah=(UCHAR)GetReg1(P3d4,0x37); + LCDInfo=tempah; + + if(!(VBInfo&SetCRT2ToLCD)){ + return 1; + } + if(!(VBInfo&(SetSimuScanMode|SwitchToCRT2))){ + return 1; + } + if(VBInfo&SetInSlaveMode){ + if(VBInfo&SetNotSimuTVMode){ + SetFlag=SetFlag|LCDVESATiming; + } + }else{ + SetFlag=SetFlag|LCDVESATiming; + } + return 1; +} + +VOID PresetScratchregister(USHORT P3d4) +{ + SetReg1(P3d4,0x37,0x00); +} + +BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn) +{ + USHORT tempah; +/*tempah=(HwDeviceExtension->usLCDType);// set in sisv.c */ + tempah=1; + SetReg1(P3d4,0x36,tempah); /* cr 36 0:no LCD 1:1024x768 2:1280x1024 */ + if(tempah>0) return 1; + else return 0; +} + +VOID SetTVSystem() +{ + USHORT tempah; + tempah=GetReg1(P3c4,0x38); /* SR 38 */ + tempah=tempah&0x01; /* get SR 38 D0 TV Type Selection */ + /* 0:NTSC 1:PAL */ + SetRegANDOR(P3d4,0x31,~0x01,tempah); /* set CR 31 D0= SR 38 D0 */ + return; +} + +VOID LongWait() +{ + USHORT i; + for(i=0; i<0xFFFF; i++) { + if(!(inSISREG(P3da) & 0x08)) + break; + } + for(i=0; i<0xFFFF; i++) { + if((inSISREG(P3da) & 0x09) == 9) + break; + } +} + +VOID VBLongWait() +{ + USHORT regsr1f,tempah,temp; + + regsr1f=GetReg1(P3c4,0x1F); + tempah=regsr1f&(~0xC0); + SetReg1(P3c4,0x1F,tempah); + + for(temp=1;temp>0;){ + temp=GetReg2(P3da); + temp=temp&0x08; + } + for(;temp==0;){ + temp=GetReg2(P3da); + temp=temp&0x08; + } + + SetReg1(P3c4,0x1F,regsr1f); + return; +} + +BOOLEAN WaitVBRetrace(USHORT BaseAddr) +{ + USHORT temp; + USHORT Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + temp=GetReg1(Part1Port,0x00); + if(!(temp&0x80)){ + return 0; + } + + for(temp=0;temp==0;){ + temp=GetReg1(Part1Port,0x25); + temp=temp&0x01; + } + for(;temp>0;){ + temp=GetReg1(Part1Port,0x25); + temp=temp&0x01; + } + return 1; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h new file mode 100644 index 000000000..73ff0d3d0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h @@ -0,0 +1,127 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.2 2000/08/03 12:24:03 dawes Exp $ */ + +#include "initdef.h" + +USHORT VBInfo,SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; +USHORT VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; +USHORT LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; + +USHORT StResInfo[5][2]={{640,400},{640,350},{720,400},{720,350},{640,480}}; +USHORT ModeResInfo[13][4]={{320,200,8,8},{320,240,8,8},{320,400,8,8}, + {400,300,8,8},{512,384,8,8},{640,400,8,16}, + {640,480,8,16},{800,600,8,16},{1024,768,8,16}, + {1280,1024,8,16},{1600,1200,8,16},{1920,1440,8,16}, + {2048,1536,8,16}}; + +USHORT NTSCTiming[61]={0x017,0x01D,0x003,0x009,0x005,0x006,0x00C,0x00C, + 0x094,0x049,0x001,0x00A,0x006,0x00D,0x004,0x00A, + 0x006,0x014,0x00D,0x004,0x00A,0x000,0x085,0x01B, + 0x00C,0x050,0x000,0x099,0x000,0x0EC,0x04A,0x017, + 0x088,0x000,0x04B,0x000,0x000,0x0E2,0x000,0x002, + 0x003,0x00A,0x065,0x09D,0x008, + 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, + 0x060,0x014,0x050,0x000,0x040, + 0x00044,0x002DB,0x0003B}; /* Ajust xxx */ + +USHORT PALTiming[61]={ 0x019,0x052,0x035,0x06E,0x004,0x038,0x03D,0x070, + 0x094,0x049,0x001,0x012,0x006,0x03E,0x035,0x06D, + 0x006,0x014,0x03E,0x035,0x06D,0x000,0x045,0x02B, + 0x070,0x050,0x000,0x097,0x000,0x0D7,0x05D,0x017, + 0x088,0x000,0x045,0x000,0x000,0x0E8,0x000,0x002, + 0x00D,0x000,0x068,0x0B0,0x00B, + 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, + 0x060,0x014,0x063,0x000,0x040, + 0x0003E,0x002E1,0x00028}; /* Ajust xxx */ + +USHORT NTSCGroup3Data[63]= {0x000,0x014,0x015,0x025,0x055,0x015,0x00B,0x089, + 0x0D7,0x040,0x0B0,0x0B0,0x0FF,0x0C4,0x045,0x0A6, + 0x025,0x02F,0x067,0x0F6,0x0BF,0x0FF,0x08E,0x020, + 0x08C,0x0DA,0x060,0x092,0x0C8,0x055,0x08B,0x000, + 0x051,0x004,0x018,0x00A,0x0F8,0x087,0x000,0x080, + 0x03B,0x03B,0x000,0x0F0,0x0F0,0x000,0x0F0,0x0F0, + 0x000,0x051,0x00F,0x00F,0x008,0x00F,0x008,0x06F, + 0x018,0x005,0x005,0x005,0x04C,0x0AA,0x001}; + +USHORT PALGroup3Data[63]={0x000,0x01A,0x022,0x063,0x062,0x022,0x008,0x085, + 0x0C3,0x020,0x0A4,0x0A4,0x055,0x047,0x02A,0x0A6, + 0x025,0x02F,0x047,0x0FA,0x0C8,0x0FF,0x08E,0x020, + 0x08C,0x0DC,0x060,0x092,0x0C8,0x04F,0x085,0x000, + 0x056,0x036,0x04F,0x06E,0x0FE,0x083,0x054,0x081, + 0x030,0x030,0x000,0x0F3,0x0F3,0x000,0x0A2,0x0A2, + 0x000,0x048,0x0FE,0x07E,0x008,0x040,0x008,0x091, + 0x018,0x005,0x018,0x005,0x04C,0x0A8,0x001}; + +VOID SetDefCRT2ExtRegs(USHORT BaseAddr); +BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, ScrnInfoPtr pScrn); +USHORT GetRatePtrCRT2(ULONG ROMAddr, USHORT ModeNo); +BOOLEAN AjustCRT2Rate(ULONG ROMAddr); +VOID SaveCRT2Info(USHORT ModeNo); +VOID DisableLockRegs(VOID); +VOID DisableCRT2(VOID); +VOID DisableBridge(USHORT BaseAddr); +VOID GetCRT2Data(ULONG ROMAddr,USHORT ModeNo); +VOID GetResInfo(ULONG ROMAddr,USHORT ModeNo); +VOID GetRAMDAC2DATA(ULONG ROMAddr,USHORT ModeNo); +VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo); +VOID UnLockCRT2(USHORT BaseAddr); +VOID SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo); +VOID SetGroup1(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); +VOID SetCRT2Offset(USHORT Part1Port,ULONG ROMAddr); +USHORT GetOffset(ULONG ROMAddr); +USHORT GetColorDepth(ULONG ROMAddr); +VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); +USHORT GetVCLK(ULONG ROMAddr,USHORT ModeNo); +USHORT GetVCLKPtr(ULONG ROMAddr,USHORT ModeNo); +USHORT GetColorTh(ULONG ROMAddr); +USHORT GetMCLK(ULONG ROMAddr); +USHORT GetMCLKPtr(ULONG ROMAddr); +USHORT GetDRAMType(ULONG ROMAddr); +USHORT CalcDelayVB(VOID); +USHORT GetVCLK2Ptr(ULONG ROMAddr,USHORT ModeNo); +VOID SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); +VOID GetCRT1Ptr(ULONG ROMAddr); +VOID SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR); +USHORT GetVGAHT2(VOID); +VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr); +VOID SetGroup3(USHORT BaseAddr); +VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); +VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); +VOID SetGroup5(USHORT BaseAddr,ULONG ROMAddr); +VOID EnableCRT2(VOID); +VOID LoadDAC2(ULONG ROMAddr,USHORT Part5Port); +VOID WriteDAC2(USHORT Pdata,USHORT dl, USHORT ah, USHORT al, USHORT dh); +VOID LockCRT2(USHORT BaseAddr); +VOID SetLockRegs(VOID); +VOID EnableBridge(USHORT BaseAddr); +VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr); +BOOLEAN BridgeIsEnable(USHORT BaseAddr); +BOOLEAN BridgeInSlave(VOID); +BOOLEAN GetLCDResInfo(USHORT P3d4); +VOID PresetScratchregister(USHORT P3d4); +BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn); +VOID SetTVSystem(); +VOID LongWait(); +USHORT GetQueueConfig(); +VOID VBLongWait(); +USHORT GetVCLKLen(ULONG ROMAddr); +BOOLEAN WaitVBRetrace(USHORT BaseAddr); + +extern USHORT MDA_DAC[]; +extern USHORT CGA_DAC[]; +extern USHORT EGA_DAC[]; +extern USHORT VGA_DAC[]; + +extern USHORT P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; +extern USHORT flag_clearbuffer; /* 0:no clear frame buffer 1:clear frame buffer */ +extern int RAMType; +extern int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData, ECLKData; +extern int REFIndex,ModeType; + +extern VOID SetReg1(USHORT, USHORT, USHORT); +extern VOID SetReg3(USHORT, USHORT); +extern USHORT GetReg1(USHORT, USHORT); +extern USHORT GetReg2(USHORT); +extern BOOLEAN SearchModeID(ULONG, USHORT); +extern BOOLEAN GetRatePtr(ULONG, USHORT); +extern VOID SetReg4(USHORT, ULONG); +extern ULONG GetReg3(USHORT); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h new file mode 100644 index 000000000..0201d697a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h @@ -0,0 +1,89 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.2 2000/08/03 12:24:03 dawes Exp $ */ + +#define ModeInfoFlag 0x07 +#define MemoryInfoFlag 0x1E0 +#define MemorySizeShift 0x05 +#define ModeText 0x00 +#define ModeCGA 0x01 +#define ModeEGA 0x02 +#define ModeVGA 0x03 +#define Mode15Bpp 0x04 +#define Mode16Bpp 0x05 +#define Mode24Bpp 0x06 +#define Mode32Bpp 0x07 +#define CRT1Len 17 +#define DoubleScanMode 0x8000 + +#define ULONG unsigned long +#define USHORT unsigned short +#define SHORT short +#define UCHAR unsigned char +#define VOID void +#define BOOLEAN Bool + +#define InterlaceMode 0x80 +#define HalfDCLK 0x1000 +#define DACInfoFlag 0x18 +#define LineCompareOff 0x400 + +#define SelectCRT2Rate 0x4 +#define ProgrammingCRT2 0x1 +#define CRT2DisplayFlag 0x2000 +#define SetCRT2ToRAMDAC 0x0040 +#define Charx8Dot 0x0200 +#define LCDDataLen 8 +#define SetCRT2ToLCD 0x0020 +#define SetCRT2ToHiVisionTV 0x0080 +#define HiTVDataLen 12 +#define TVDataLen 16 +#define SetPALTV 0x0100 +#define SetInSlaveMode 0x0200 +#define SetCRT2ToTV 0x009C +#define SetNotSimuTVMode 0x0400 +#define SetSimuScanMode 0x0001 +#define DriverMode 0x4000 +#define CRT2Mode 0x0800 +#define HalfDCLK 0x1000 +#define NTSCHT 1716 +#define NTSCVT 525 +#define PALHT 1728 +#define PALVT 625 + +#define VCLKStartFreq 25 +#define SoftDramType 0x80 +#define VCLK65 0x09 +#define VCLK108_2 0x14 +#define TVSimuMode 0x02 +#define SetCRT2ToSVIDEO 0x08 +#define LCDRGB18Bit 0x01 +#define Panel1280x1024 0x01 +#define Panel1024x768 0x00 +#define RPLLDIV2XO 0x04 +#define LoadDACFlag 0x1000 +#define AfterLockCRT2 0x4000 +#define SupportRAMDAC2 0x0040 +#define SupportLCD 0x0020 +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSCART 0x0010 +#define NoSupportSimuTV 0x2000 +#define Ext2StructSize 5 +#define SupportTV 0x0008 +#define TVVCLKDIV2 0x021 +#define TVVCLK 0x022 +#define SwitchToCRT2 0x0002 +#define LCDVESATiming 0x08 +#define SetSCARTOutput 0x01 +#define SCARTSense 0x04 +#define Monitor1Sense 0x20 +#define Monitor2Sense 0x10 +#define SVIDEOSense 0x02 +#define AVIDEOSense 0x01 +#define LCDSense 0x08 +#define BoardTVType 0x02 +#define HotPlugFunction 0x08 +#define StStructSize 0x06 + +#define IND_SIS_CRT2_PORT_04 0x04 - 0x030 +#define IND_SIS_CRT2_PORT_10 0x10 - 0x30 +#define IND_SIS_CRT2_PORT_12 0x12 - 0x30 +#define IND_SIS_CRT2_PORT_14 0x14 - 0x30 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h index 42719b5d7..66a6b5dc6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.14 2000/06/26 22:27:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.16 2000/08/01 20:52:24 dawes Exp $ */ #ifndef _SIS_H #define _SIS_H_ @@ -33,158 +33,193 @@ #include "xf86Pci.h" #include "xf86Cursor.h" +#include "xf86_ansic.h" #include "compiler.h" #include "xaa.h" #include "vgaHW.h" -#define SIS_NAME "SIS" -#define SIS_DRIVER_NAME "sis" -#define SIS_MAJOR_VERSION 0 -#define SIS_MINOR_VERSION 6 -#define SIS_PATCHLEVEL 0 -#define SIS_CURRENT_VERSION ((SIS_MAJOR_VERSION << 16) | \ - (SIS_MINOR_VERSION << 8) | SIS_PATCHLEVEL ) - -#define UMA 0x00000001 -#define MMIOMODE 0x00000001 -#define LFBQMODE 0x00000002 -#define AGPQMODE 0x00000004 - -#define BIOS_BASE 0xC0000 -#define BIOS_SIZE 0x10000 - -#define CRT2_LCD 0x00000010 -#define CRT2_TV 0x00000020 -#define CRT2_VGA 0x00000040 -#define CRT2_ENABLE 0x00000070 -#define LCD_800x600 0x00000100 -#define LCD_1024x768 0x00000200 -#define LCD_1280x1024 0x00000400 -#define LCD_TYPE 0x00000700 -#define TV_NTSC 0x00001000 -#define TV_PAL 0x00002000 -#define TV_HIVISION 0x00004000 -#define TV_TYPE 0x00007000 -#define TV_AVIDEO 0x00010000 -#define TV_SVIDEO 0x00020000 -#define TV_SCART 0x00040000 -#define TV_INTERFACE 0x00070000 -#define SIS301 0x00100000 -#define SIS302 0x00200000 -#define LVDS 0x01000000 -#define CHRONTEL_TV 0x02000000 -#define SINGLE_MODE 0x00000000 -#define SIMU_MODE 0x10000000 -#define MM_MODE 0x20000000 -#define DISPLAY_MODE 0x30000000 - - -#ifdef DEBUG -#define PDEBUG(p) p +#ifdef XF86DRI +#include "xf86drm.h" +#include "sarea.h" +#define _XF86DRI_SERVER_ +#include "xf86dri.h" +#include "dri.h" +#include "GL/glxint.h" +#include "sis_dri.h" +#endif + +#define SIS_NAME "SIS" +#define SIS_DRIVER_NAME "sis" +#define SIS_MAJOR_VERSION 0 +#define SIS_MINOR_VERSION 6 +#define SIS_PATCHLEVEL 0 +#define SIS_CURRENT_VERSION ((SIS_MAJOR_VERSION << 16) | \ + (SIS_MINOR_VERSION << 8) | SIS_PATCHLEVEL ) + +#define UMA 0x00000001 +#define MMIOMODE 0x00000001 +#define LFBQMODE 0x00000002 +#define AGPQMODE 0x00000004 + +#define BIOS_BASE 0xC0000 +#define BIOS_SIZE 0x10000 + +#define CRT2_LCD 0x00000010 +#define CRT2_TV 0x00000020 +#define CRT2_VGA 0x00000040 +#define CRT2_ENABLE 0x00000070 +#define LCD_800x600 0x00000100 +#define LCD_1024x768 0x00000200 +#define LCD_1280x1024 0x00000400 +#define LCD_TYPE 0x00000700 +#define TV_NTSC 0x00001000 +#define TV_PAL 0x00002000 +#define TV_HIVISION 0x00004000 +#define TV_TYPE 0x00007000 +#define TV_AVIDEO 0x00010000 +#define TV_SVIDEO 0x00020000 +#define TV_SCART 0x00040000 +#define TV_INTERFACE 0x00070000 +#define SIS301 0x00100000 +#define SIS302 0x00200000 +#define LVDS 0x01000000 +#define CHRONTEL_TV 0x02000000 +#define SINGLE_MODE 0x00000000 +#define SIMU_MODE 0x10000000 +#define MM_MODE 0x20000000 +#define DISPLAY_MODE 0x30000000 + +#define MASK_DISPTYPE_CRT2 0x04 /* Connect LCD */ +#define MASK_DISPTYPE_LCD 0x02 /* Connect LCD */ +#define MASK_DISPTYPE_TV 0x01 /* Connect TV */ +#define MASK_DISPTYPE_DISP2 (MASK_DISPTYPE_LCD | MASK_DISPTYPE_TV | MASK_DISPTYPE_CRT2) + +#ifdef DEBUG +#define PDEBUG(p) p #else -#define PDEBUG(p) +#define PDEBUG(p) #endif typedef struct { - unsigned char sisRegs3C4[0x50]; - unsigned char sisRegs3D4[0x40]; - unsigned char sisRegs3C2; - unsigned char VBPart1[0x29]; - unsigned char VBPart2[0x46]; - unsigned char VBPart3[0x3F]; - unsigned char VBPart4[0x1C]; + unsigned char sisRegs3C4[0x50]; + unsigned char sisRegs3D4[0x40]; + unsigned char sisRegs3C2; + unsigned char VBPart1[0x29]; + unsigned char VBPart2[0x46]; + unsigned char VBPart3[0x3F]; + unsigned char VBPart4[0x1C]; } SISRegRec, *SISRegPtr; -#define SISPTR(p) ((SISPtr)((p)->driverPrivate)) -#define XAAPTR(p) ((XAAInfoRecPtr)(SISPTR(p)->AccelInfoPtr)) +#define SISPTR(p) ((SISPtr)((p)->driverPrivate)) +#define XAAPTR(p) ((XAAInfoRecPtr)(SISPTR(p)->AccelInfoPtr)) typedef struct { - ScrnInfoPtr pScrn; - pciVideoPtr PciInfo; - PCITAG PciTag; - EntityInfoPtr pEnt; - int Chipset; - int ChipRev; - CARD32 FbAddress; /* VRAM physical address */ - unsigned char * FbBase; /* VRAM linear address */ - CARD32 IOAddress; /* MMIO physical address */ - unsigned char * IOBase; /* MMIO linear address */ + ScrnInfoPtr pScrn; + pciVideoPtr PciInfo; + PCITAG PciTag; + EntityInfoPtr pEnt; + int Chipset; + int ChipRev; + CARD32 FbAddress; /* VRAM physical address */ + unsigned char * FbBase; /* VRAM linear address */ + CARD32 IOAddress; /* MMIO physical address */ + unsigned char * IOBase; /* MMIO linear address */ #ifdef __alpha__ - unsigned char * IOBaseDense; /* MMIO for Alpha platform */ + unsigned char * IOBaseDense; /* MMIO for Alpha platform */ +#endif + CARD16 RelIO; /* Relocate IO Base */ + unsigned char * BIOS; + int MemClock; + int BusWidth; + int MinClock; + int MaxClock; + int Flags; /* HW config flags */ + long FbMapSize; + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + Bool NoAccel; + Bool HWCursor; + Bool UsePCIRetry; + Bool TurboQueue; + Bool ValidWidth; + Bool FastVram; + int VBFlags; + int LCDFlags; + int TVFlags; + short scrnOffset; + short DstColor; + int Xdirection; + int Ydirection; + int sisPatternReg[4]; + int ROPReg; + int CommandReg; + int MaxCMDQueueLen; + int CurCMDQueueLen; + int MinCMDQueueLen; + int DstX; + int DstY; + unsigned char * XAAScanlineColorExpandBuffers[2]; + CARD32 AccelFlags; + Bool ClipEnabled; + Bool DoColorExpand; + SISRegRec SavedReg; + SISRegRec ModeReg; + xf86CursorInfoPtr CursorInfoPtr; + XAAInfoRecPtr AccelInfoPtr; + CloseScreenProcPtr CloseScreen; + unsigned int (*ddc1Read)(ScrnInfoPtr); + Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High); + void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, VisualPtr pVisual); + + int *cmdQueueLenPtr; + unsigned long agpHandle; + CARD32 agpAddr; + unsigned char *agpBase; + unsigned int agpSize; + CARD32 agpCmdBufAddr; + unsigned char *agpCmdBufBase; + unsigned int agpCmdBufSize; + unsigned int agpCmdBufFree; + Bool irqEnabled; + int irq; + +#ifdef XF86DRI + Bool directRenderingEnabled; + DRIInfoPtr pDRIInfo; + int drmSubFD; + int numVisualConfigs; + __GLXvisualConfig* pVisualConfigs; + SISConfigPrivPtr pVisualConfigsPriv; + SISRegRec DRContextRegs; #endif - CARD16 RelIO; /* Relocate IO Base */ - unsigned char * BIOS; - int MemClock; - int BusWidth; - int MinClock; - int MaxClock; - int Flags; /* HW config flags */ - long FbMapSize; - DGAModePtr DGAModes; - int numDGAModes; - Bool DGAactive; - int DGAViewportStatus; - Bool NoAccel; - Bool HWCursor; - Bool UsePCIRetry; - Bool TurboQueue; - Bool ValidWidth; - Bool FastVram; - int VBFlags; - int LCDFlags; - int TVFlags; - short scrnOffset; - short DstColor; - int Xdirection; - int Ydirection; - int sisPatternReg[4]; - int ROPReg; - int CommandReg; - int MaxCMDQueueLen; - int CurCMDQueueLen; - int MinCMDQueueLen; - int DstX; - int DstY; - unsigned char * XAAScanlineColorExpandBuffers[2]; - CARD32 AccelFlags; - Bool ClipEnabled; - Bool DoColorExpand; - SISRegRec SavedReg; - SISRegRec ModeReg; - xf86CursorInfoPtr CursorInfoPtr; - XAAInfoRecPtr AccelInfoPtr; - CloseScreenProcPtr CloseScreen; - unsigned int (*ddc1Read)(ScrnInfoPtr); - Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); - Bool (*ModeInit2)(ScrnInfoPtr pScrn, DisplayModePtr mode); - void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); - void (*SetThreshold2)(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); - void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, - int *indicies, LOCO *colors, VisualPtr pVisual); } SISRec, *SISPtr; /* Prototypes */ void SiSOptions(ScrnInfoPtr pScrn); -void SISVGAPreInit(ScrnInfoPtr pScrn); -void SISLCDPreInit(ScrnInfoPtr pScrn); -void SISTVPreInit(ScrnInfoPtr pScrn); +void SISVGAPreInit(ScrnInfoPtr pScrn); +void SISLCDPreInit(ScrnInfoPtr pScrn); +void SISTVPreInit(ScrnInfoPtr pScrn); +void SISCRT2PreInit(ScrnInfoPtr pScrn); OptionInfoPtr SISAvailableOptions(int chipid, int busid); -void SISDACPreInit(ScrnInfoPtr pScrn); -void SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, - LOCO *colors, VisualPtr pVisual); +void SISDACPreInit(ScrnInfoPtr pScrn); +void SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, + LOCO *colors, VisualPtr pVisual); int compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, - int *out_sbit, int *out_scale); + int *out_sbit, int *out_scale); void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, - unsigned int *vclk); + unsigned int *vclk); unsigned int SiSddc1Read(ScrnInfoPtr pScrn); Bool SiSAccelInit(ScreenPtr pScreen); Bool SiS530AccelInit(ScreenPtr pScreen); @@ -196,8 +231,19 @@ Bool SiSHWCursorInit(ScreenPtr pScreen); void SiSIODump(ScrnInfoPtr pScreen); void SiSInitializeAccelerator(ScrnInfoPtr pScrn); void SiSSetup(ScrnInfoPtr pScrn); +void SiSPreSetMode(ScrnInfoPtr pScrn); -extern Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags); +extern void SetReg1(unsigned short, unsigned short, unsigned short); +extern unsigned short GetReg1(unsigned short, unsigned short); + +extern Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags); + +#ifdef XF86DRI +extern void FillPrivateDRI(SISPtr pSIS, SISDRIPtr pSISDRI); +extern Bool SISDRIScreenInit(ScreenPtr pScreen); +extern void SISDRICloseScreen(ScreenPtr pScreen); +Bool SISDRIFinishScreenInit(ScreenPtr pScreen); +#endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c index 8c9c128b3..8468b1ad6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.17 2000/06/15 20:50:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.18 2000/08/04 16:13:33 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -260,8 +260,8 @@ SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int isTransparent = ( bg == -1 ); dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; - sisSETBGCOLOR(bg); sisSETFGCOLOR(fg); + sisSETBGCOLOR(bg); sisSETROPFG(rop); if (!isTransparent) { sisSETROPBG(0xcc); /* copy */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c index 06cc9c3f0..5d81cdcc5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.14 2000/03/31 20:13:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.15 2000/08/01 20:52:24 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -38,7 +38,7 @@ #include "sis.h" #include "sis_regs.h" -#include "sis_bios.h" +#include "sis_vb.h" static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); @@ -53,8 +53,6 @@ static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, static void SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); -static void SiS301Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); static void SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, @@ -62,8 +60,6 @@ static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); -static unsigned int GetClock(int Num, int DeNum, int PostScale, int Div); - int compute_vclk( int Clock, @@ -74,7 +70,7 @@ compute_vclk( int *out_scale) { float f,x,y,t, error, min_error; - int n, dn, best_n, best_dn; + int n, dn, best_n=0, best_dn=0; /* * Rules @@ -174,7 +170,7 @@ SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) { SISPtr pSiS = SISPTR(pScrn); int M, N, P , PSN, VLD , PSNx ; - int bestM, bestN, bestP, bestPSN, bestVLD; + int bestM=0, bestN=0, bestP=0, bestPSN=0, bestVLD=0; double bestError, abest = 42.0, bestFout; double target; double Fvco, Fout; @@ -510,8 +506,8 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) "Restore to - %02X Read after - %02X\n", sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); } - if (pSiS->VBFlags & CRT2_ENABLE) { /* For SiS301 */ - (*pSiS->SiSRestore2)(pScrn, sisReg); + if (pSiS->VBFlags & CRT2_ENABLE) { /* For SiS301 */ + (*pSiS->SiSRestore2)(pScrn, sisReg); } outb(0x3C2, sisReg->sisRegs3C2); @@ -549,9 +545,10 @@ static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); + unsigned char temp, temp1; - DisableBridge(pSiS->RelIO); - UnLockCRT2(pSiS->RelIO); + DisableBridge(pSiS->RelIO+0x30); + UnLockCRT2(pSiS->RelIO+0x30); /* SetCRT2ModeRegs() */ outSISIDXREG(pSiS->RelIO+0x04, 4, 0); @@ -560,11 +557,11 @@ SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); if (!(sisReg->sisRegs3D4[0x30] & 0x03) && (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - LockCRT2(pSiS->RelIO); + LockCRT2(pSiS->RelIO+0x30); return; } SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); @@ -577,10 +574,25 @@ SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) outSISIDXREG(pSiS->RelIO+0x14, 0x0B, sisReg->VBPart4[0x0B]); outSISIDXREG(pSiS->RelIO+0x14, 0x0A, sisReg->VBPart4[0x0A]); outSISIDXREG(pSiS->RelIO+0x14, 0x12, 0); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); + outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); - EnableBridge(pSiS->RelIO); - LockCRT2(pSiS->RelIO); + + temp1 = 0; + if(!(pSiS->VBFlags & CRT2_VGA)) { + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); + if (temp & (SET_IN_SLAVE_MODE >> 8)) { + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); + if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { + temp1 = 0x20; + } + } + } + setSISIDXREG(pSiS->RelIO+SROFFSET, 0x32, ~0x20, temp1); + orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); + andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + + EnableBridge(pSiS->RelIO+0x30); + LockCRT2(pSiS->RelIO+0x30); } unsigned int @@ -932,63 +944,6 @@ SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, } static void -SiS301Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High) -{ - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr sisReg = &pSiS->ModeReg; - unsigned int delay; - unsigned int mclk = pSiS->MemClock/1000; - unsigned int dclk = mode->Clock/1000; - unsigned int buswidth = pSiS->BusWidth/8; - unsigned int bpp = (pScrn->bitsPerPixel+7)/8; - unsigned int tclk; - int i, GT, QC, idx, timing_idx, CRT1RP; - int Num, DeNum, PostScale, Div; /* for clock gen */ - PCITAG NBridge; - - /* Get Delay */ - if (pSiS->Chipset == PCI_CHIP_SIS300) { - idx = GETBITS(sisReg->sisRegs3C4[0x16], 7:6) | - GETBITSTR(sisReg->sisRegs3C4[0x14], 7:6, 3:2); - timing_idx = GETBITS(sisReg->sisRegs3C4[0x18], 0:0) | - GETBITSTR(sisReg->sisRegs3C4[0x18], 6:5, 2:1); - delay = funcb[idx].base + funcb[idx].inc * timing[timing_idx]; - } else { - NBridge = pciTag(0,0,0); - QC = GETBITS(pciReadLong(NBridge, 0x50), 27:24); - GT = GETBITS(pciReadLong(NBridge, 0xA0), 27:24); - for (i=0; i<20; i++) { - if ((qconfig[i].QC == QC) && (qconfig[i].GT==GT)) - break; - } - if (buswidth == 8) /* 64-bits */ - delay = cycleA[i][0]+20; - else - delay = cycleA[i][1]+15; - } - /* Get TCLK */ - Num = GETBITS(sisReg->VBPart4[0x0A], 6:0); - DeNum = GETBITS(sisReg->VBPart4[0x0B], 4:0); - PostScale = GETBITS(sisReg->VBPart4[0x0B], 7:5); - Div = GETBITS(sisReg->VBPart4[0x0A], 7:7); - tclk = GetClock(Num, DeNum, PostScale, Div); - - CRT1RP = delay + - (int)(28*16/(buswidth - 1.0*dclk*bpp/mclk) + 0.9999); - *Low = 1.0*CRT1RP*tclk*bpp/(16*mclk) + 0.9999; /* Roundup */ - - if (*Low < 6) *Low = 6; - if (*Low > 0x14) *Low = 0x14; - - *High = 0x16; - if (pSiS->Chipset == PCI_CHIP_SIS300) { - if (*Low <= 0x0F) - *High = 0x13; - } -} - -static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { @@ -1019,16 +974,6 @@ SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, } -static unsigned int -GetClock(int Num, int DeNum, int PostScale, int Div) -{ - Num++; - DeNum++; - Div++; - PostScale = (GETBITS(PostScale, 1:0)+1) * (GETBITS(PostScale, 2:2)+1); - return 14318.18*Num*Div/(DeNum*PostScale); -} - void SiSIODump(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); int i, max3c4, min3d4, max3d4; @@ -1127,7 +1072,6 @@ SISDACPreInit(ScrnInfoPtr pScrn) pSiS->SiSRestore2 = SiS301Restore; pSiS->LoadCRT2Palette = SiS301LoadPalette; pSiS->SetThreshold = SiS630Threshold; - pSiS->SetThreshold2 = SiS301Threshold; break; case PCI_CHIP_SIS300: pSiS->MaxClock = sis300MemBandWidth(pScrn); @@ -1137,7 +1081,6 @@ SISDACPreInit(ScrnInfoPtr pScrn) pSiS->SiSRestore2 = SiS301Restore; pSiS->LoadCRT2Palette = SiS301LoadPalette; pSiS->SetThreshold = SiS300Threshold; - pSiS->SetThreshold2 = SiS301Threshold; break; case PCI_CHIP_SIS530: pSiS->MaxClock = 230000; /* Guest */ @@ -1158,3 +1101,13 @@ SISDACPreInit(ScrnInfoPtr pScrn) pSiS->SetThreshold = SiSThreshold; } } + +void +SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr) +{ + CARD8 index; + + for (index=from; index <= to; index++, DataPtr++) { + outSISIDXREG(port, index, *DataPtr); + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c new file mode 100644 index 000000000..3e52def07 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c @@ -0,0 +1,562 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ + +/* modified from tdfx_dri.c, mga_dri.c */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Priv.h" + +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#define PSZ 8 +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb32.h" + +#include "miline.h" + +#include "GL/glxtokens.h" + +#include "sis.h" +#include "sis_dri.h" + +#include "sis300_accel.h" + +#include "sis_drm_public.h" +#include "drm.h" + +extern void GlxSetVisualConfigs( + int nconfigs, + __GLXvisualConfig *configs, + void **configprivs +); + +#define AGP_PAGE_SIZE 4096 +#define AGP_PAGES 2048 +#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES) +#define AGP_CMDBUF_PAGES 256 +#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES) + +static char SISKernelDriverName[] = "sis"; +static char SISClientDriverName[] = "sis"; + +static Bool SISInitVisualConfigs(ScreenPtr pScreen); +static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore); +static void SISDestroyContext(ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore); +static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, + void *readContextStore, + DRIContextType writeContextType, + void *writeContextStore); +static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); +static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index); + +void SISLostContext(ScreenPtr pScreen); + +static Bool +SISInitVisualConfigs(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSIS = SISPTR(pScrn); + int numConfigs = 0; + __GLXvisualConfig *pConfigs = 0; + SISConfigPrivPtr pSISConfigs = 0; + SISConfigPrivPtr *pSISConfigPtrs = 0; + int i, db, z_stencil, accum; + Bool useZ16 = FALSE; + + if(getenv("SIS_FORCE_Z16")){ + useZ16 = TRUE; + } + + switch (pScrn->bitsPerPixel) { + case 8: + case 24: + break; + case 16: + case 32: + numConfigs = (useZ16)?8:16; + + if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + numConfigs))) { + return FALSE; + } + if (!(pSISConfigs = (SISConfigPrivPtr)xnfcalloc(sizeof(SISConfigPrivRec), + numConfigs))) { + xfree(pConfigs); + return FALSE; + } + if (!(pSISConfigPtrs = (SISConfigPrivPtr*)xnfcalloc(sizeof(SISConfigPrivPtr), + numConfigs))) { + xfree(pConfigs); + xfree(pSISConfigs); + return FALSE; + } + for (i=0; i<numConfigs; i++) + pSISConfigPtrs[i] = &pSISConfigs[i]; + + i = 0; + for (accum = 0; accum <= 1; accum++) { + for (z_stencil=0; z_stencil<(useZ16?2:4); z_stencil++) { + for (db = 0; db <= 1; db++) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = -1; + pConfigs[i].greenSize = -1; + pConfigs[i].blueSize = -1; + pConfigs[i].redMask = -1; + pConfigs[i].greenMask = -1; + pConfigs[i].blueMask = -1; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 16; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = -1; + switch (z_stencil){ + case 0: + pConfigs[i].depthSize = 0; + pConfigs[i].stencilSize = 0; + break; + case 1: + pConfigs[i].depthSize = 16; + pConfigs[i].stencilSize = 0; + break; + case 2: + pConfigs[i].depthSize = 32; + pConfigs[i].stencilSize = 0; + break; + case 3: + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; + break; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + if (i != numConfigs) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n"); + return FALSE; + } + break; + } + + pSIS->numVisualConfigs = numConfigs; + pSIS->pVisualConfigs = pConfigs; + pSIS->pVisualConfigsPriv = pSISConfigs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pSISConfigPtrs); + + return TRUE; +} + +Bool SISDRIScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSIS = SISPTR(pScrn); + DRIInfoPtr pDRIInfo; + SISDRIPtr pSISDRI; + +{ + unsigned int port_3c5_value; + + /* Set magic number */ + outb (0x3c4, 0x05); + if (inb (0x3c5) == 0x21){ + outb (0x3c4, 0x05); + outb (0x3c5, 0x86); + } + + /* Enable 2D/3D */ + outb (0x3c4, 0x1E); + port_3c5_value = inb (0x3c5); + port_3c5_value |= 0x5A; + outb (0x3c5, port_3c5_value); + + /* Enable HW to retry MMIO command */ + outb (0x3c4, 0x22); + outb (0x3c5, 0xb2); +} + + /* Check that the GLX, DRI, and DRM modules have been loaded by testing + * for canonical symbols in each module. */ + if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; + if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; + if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; + if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "SISDRIScreenInit failed (libdri.a too old)\n"); + return FALSE; + } + + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + + pDRIInfo = DRICreateInfoRec(); + if (!pDRIInfo) return FALSE; + pSIS->pDRIInfo = pDRIInfo; + + pDRIInfo->drmDriverName = SISKernelDriverName; + pDRIInfo->clientDriverName = SISClientDriverName; + pDRIInfo->busIdString = xalloc(64); + sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", + ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); + pDRIInfo->ddxDriverMajorVersion = 0; + pDRIInfo->ddxDriverMinorVersion = 1; + pDRIInfo->ddxDriverPatchVersion = 0; + pDRIInfo->frameBufferPhysicalAddress = pSIS->FbAddress; + pDRIInfo->frameBufferSize = pSIS->FbMapSize; + + /* ?? */ + pDRIInfo->frameBufferStride = pSIS->scrnOffset; + pDRIInfo->ddxDrawableTableEntry = SIS_MAX_DRAWABLES; + + if (SAREA_MAX_DRAWABLES < SIS_MAX_DRAWABLES) + pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; + else + pDRIInfo->maxDrawableTableEntry = SIS_MAX_DRAWABLES; + +#ifdef NOT_DONE + /* FIXME need to extend DRI protocol to pass this size back to client + * for SAREA mapping that includes a device private record + */ + pDRIInfo->SAREASize = + ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ + /* + shared memory device private rec */ +#else + /* For now the mapping works by using a fixed size defined + * in the SAREA header + */ + if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv)>SAREA_MAX) { + ErrorF("Data does not fit in SAREA\n"); + return FALSE; + } + pDRIInfo->SAREASize = SAREA_MAX; +#endif + + if (!(pSISDRI = (SISDRIPtr)xnfcalloc(sizeof(SISDRIRec),1))) { + DRIDestroyInfoRec(pSIS->pDRIInfo); + pSIS->pDRIInfo=0; + return FALSE; + } + pDRIInfo->devPrivate = pSISDRI; + pDRIInfo->devPrivateSize = sizeof(SISDRIRec); + pDRIInfo->contextSize = sizeof(SISDRIContextRec); + + pDRIInfo->CreateContext = SISCreateContext; + pDRIInfo->DestroyContext = SISDestroyContext; + pDRIInfo->SwapContext = SISDRISwapContext; + pDRIInfo->InitBuffers = SISDRIInitBuffers; + pDRIInfo->MoveBuffers = SISDRIMoveBuffers; + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + + if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) { + xfree(pDRIInfo->devPrivate); + pDRIInfo->devPrivate=0; + DRIDestroyInfoRec(pSIS->pDRIInfo); + pSIS->pDRIInfo=0; + pSIS->drmSubFD = -1; + return FALSE; + } + + pSISDRI->regs.size = SISIOMAPSIZE; + pSISDRI->regs.map = 0; + if (drmAddMap(pSIS->drmSubFD, (drmHandle)pSIS->IOAddress, + pSISDRI->regs.size, DRM_REGISTERS, 0, + &pSISDRI->regs.handle)<0) + { + SISDRICloseScreen(pScreen); + return FALSE; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", + pSISDRI->regs.handle); + + /* AGP */ + do{ + pSIS->agpSize = 0; + pSIS->agpCmdBufSize = 0; + pSISDRI->AGPCmdBufSize = 0; + + /* TODO: if enable fails, not call drmAgpRelease */ + if (drmAgpAcquire(pSIS->drmSubFD) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n"); + break; + } + + /* TODO: default value is 2x? */ + if (drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD)&~0x0) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); + break; + } + ErrorF("[drm] drmAgpEnabled succeeded\n"); + + drmAgpAlloc(pSIS->drmSubFD, AGP_SIZE, 0, 0, &pSIS->agpHandle); + + if (pSIS->agpHandle == 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAgpAlloc failed\n"); + break; + } + + if (drmAgpBind(pSIS->drmSubFD, pSIS->agpHandle, 0) < 0) { + DRICloseScreen(pScreen); xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAgpBind failed\n"); + break; + } + + pSIS->agpSize = AGP_SIZE; + pSIS->agpAddr = drmAgpBase(pSIS->drmSubFD); + /* pSIS->agpBase = */ + + pSISDRI->agp.size = pSIS->agpSize; + if (drmAddMap(pSIS->drmSubFD, (drmHandle)0, + pSISDRI->agp.size, DRM_AGP, 0, + &pSISDRI->agp.handle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to map public agp area\n"); + pSISDRI->agp.size = 0; + break; + } + + pSIS->agpCmdBufSize = AGP_CMDBUF_SIZE; + pSIS->agpCmdBufAddr = pSIS->agpAddr; + pSIS->agpCmdBufBase = pSIS->agpCmdBufAddr - pSIS->agpAddr + + pSIS->agpBase; + pSIS->agpCmdBufFree = 0; + + pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr; + pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize; + + { + drm_sis_agp_t agp; + + agp.offset = AGP_CMDBUF_SIZE; + agp.size = AGP_SIZE - AGP_CMDBUF_SIZE; + xf86ioctl(pSIS->drmSubFD, SIS_IOCTL_AGP_INIT, &agp); + } + } + while(0); + + /* enable IRQ */ + pSIS->irq = drmGetInterruptFromBusID(pSIS->drmSubFD, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); + + if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding irq %d handler, stereo disabled\n", + pSIS->irq); + pSIS->irqEnabled = FALSE; + } + else + { + pSIS->irqEnabled = TRUE; + } + + pSISDRI->irqEnabled = pSIS->irqEnabled; + + if (!(SISInitVisualConfigs(pScreen))) { + SISDRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + + return TRUE; +} + +void +SISDRICloseScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSIS = SISPTR(pScrn); + + DRICloseScreen(pScreen); + + if (pSIS->pDRIInfo) { + if (pSIS->pDRIInfo->devPrivate) { + xfree(pSIS->pDRIInfo->devPrivate); + pSIS->pDRIInfo->devPrivate=0; + } + DRIDestroyInfoRec(pSIS->pDRIInfo); + pSIS->pDRIInfo=0; + } + if (pSIS->pVisualConfigs) xfree(pSIS->pVisualConfigs); + if (pSIS->pVisualConfigsPriv) xfree(pSIS->pVisualConfigsPriv); + + if(pSIS->agpSize){ + ErrorF("Freeing agp memory\n"); + drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle); + ErrorF("releasing agp module\n"); + drmAgpRelease(pSIS->drmSubFD); + } +} + +/* TODO: xserver receives driver's swapping event and do something + * according the data initialized in this function + */ +static Bool +SISCreateContext(ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore) +{ + return TRUE; +} + +static void +SISDestroyContext(ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore) +{ +} + +Bool +SISDRIFinishScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + SISDRIPtr pSISDRI; + + pSiS->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + /* pSiS->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ + + pSISDRI=(SISDRIPtr)pSiS->pDRIInfo->devPrivate; + pSISDRI->deviceID=pSiS->Chipset; + pSISDRI->width=pScrn->virtualX; + pSISDRI->height=pScrn->virtualY; + pSISDRI->mem=pScrn->videoRam*1024; + pSISDRI->bytesPerPixel= (pScrn->bitsPerPixel+7) / 8; + /* TODO */ + pSISDRI->scrnX=pSISDRI->width; + pSISDRI->scrnY=pSISDRI->height; + +/* + pSISDRI->textureOffset=pSiS->texOffset; + pSISDRI->textureSize=pSiS->texSize; + pSISDRI->fbOffset=pSiS->fbOffset; + pSISDRI->backOffset=pSiS->backOffset; + pSISDRI->depthOffset=pSiS->depthOffset; +*/ + + /* set SAREA value */ + { + SISSAREAPriv *saPriv; + + saPriv=(SISSAREAPriv*)DRIGetSAREAPrivate(pScreen); + + assert(saPriv); + + saPriv->CtxOwner = -1; + saPriv->QueueLength = 0; + pSiS->cmdQueueLenPtr = &(saPriv->QueueLength); + saPriv->AGPCmdBufNext = 0; + + /* frame control */ + saPriv->FrameCount = 0; + *(unsigned long *)(pSiS->IOBase+0x8a2c) = 0; + SiSIdle + } + + return DRIFinishScreenInit(pScreen); +} + +static void +SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSIS = SISPTR(pScrn); + +#if 0 + if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */ + SISSwapContextPrivate(pScreen); + } + if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { /* Exiting from Block Handler */ + SISLostContext(pScreen); + } +#endif + + /* mEndPrimitive */ + /* + * TODO: do this only if X-Server get lock. If kernel supports delayed + * signal, needless to do this + */ + *(pSIS->IOBase + 0X8B50) = 0xff; + *(unsigned int *)(pSIS->IOBase + 0x8B60) = -1; + +} + +static void +SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + + SiSIdle +} + +static void +SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index) +{ + ScreenPtr pScreen = pParent->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + + SiSIdle +} + +#if 0 +void SISLostContext(ScreenPtr pScreen) +{ +} + +void SISSwapContextPrivate(ScreenPtr pScreen) +{ +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h new file mode 100644 index 000000000..32d477566 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h @@ -0,0 +1,60 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ + +/* modified from tdfx_dri.h */ + +#ifndef _SIS_DRI_ +#define _SIS_DRI_ + +#include <xf86drm.h> + +#define SIS_MAX_DRAWABLES 256 +#define SISIOMAPSIZE (64*1024) + +typedef struct { + int CtxOwner; + int QueueLength; + unsigned int AGPCmdBufNext; + unsigned int FrameCount; +} SISSAREAPriv; + +#define SIS_FRONT 0 +#define SIS_BACK 1 +#define SIS_DEPTH 2 + +typedef struct { + drmHandle handle; + drmSize size; + drmAddress map; +} sisRegion, *sisRegionPtr; + +typedef struct { + sisRegion regs, agp; + int deviceID; + int width; + int height; + int mem; + int bytesPerPixel; + int priv1; + int priv2; + int fbOffset; + int backOffset; + int depthOffset; + int textureOffset; + int textureSize; + unsigned int AGPCmdBufOffset; + unsigned int AGPCmdBufSize; + int irqEnabled; + unsigned int scrnX, scrnY; +} SISDRIRec, *SISDRIPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} SISConfigPrivRec, *SISConfigPrivPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} SISDRIContextRec, *SISDRIContextPtr; + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c index b286e545f..ae98e0720 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.47 2000/06/26 10:26:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.49 2000/08/04 16:13:33 eich Exp $ */ #define PSZ 8 @@ -56,7 +56,7 @@ #include "sis.h" #include "sis_regs.h" -#include "sis_bios.h" +#include "sis_vb.h" #ifdef XFreeXDGA #define _XF86DGA_SERVER_ @@ -69,31 +69,35 @@ #include "extensions/dpms.h" #endif -static void SISIdentify(int flags); -static Bool SISProbe(DriverPtr drv, int flags); -static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); -static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, - char **argv); -static Bool SISEnterVT(int scrnIndex, int flags); -static void SISLeaveVT(int scrnIndex, int flags); -static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool SISSaveScreen(ScreenPtr pScreen, int mode); +#ifdef XF86DRI +#include "dri.h" +#endif + +static void SISIdentify(int flags); +static Bool SISProbe(DriverPtr drv, int flags); +static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); +static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, + char **argv); +static Bool SISEnterVT(int scrnIndex, int flags); +static void SISLeaveVT(int scrnIndex, int flags); +static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool SISSaveScreen(ScreenPtr pScreen, int mode); /* Optional functions */ -static void SISFreeScreen(int scrnIndex, int flags); -static int SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, - int flags); +static void SISFreeScreen(int scrnIndex, int flags); +static int SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, + int flags); /* Internally used functions */ -static Bool SISMapMem(ScrnInfoPtr pScrn); -static Bool SISUnmapMem(ScrnInfoPtr pScrn); -static void SISSave(ScrnInfoPtr pScrn); -static void SISRestore(ScrnInfoPtr pScrn); -static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void SISModifyModeInfo(DisplayModePtr mode); - -#ifdef DEBUG -static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool SISMapMem(ScrnInfoPtr pScrn); +static Bool SISUnmapMem(ScrnInfoPtr pScrn); +static void SISSave(ScrnInfoPtr pScrn); +static void SISRestore(ScrnInfoPtr pScrn); +static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISModifyModeInfo(DisplayModePtr mode); + +#ifdef DEBUG +static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); #endif @@ -124,46 +128,46 @@ DriverRec SIS = { static SymTabRec SISChipsets[] = { #if 0 - { PCI_CHIP_SG86C201, "SIS86c201" }, - { PCI_CHIP_SG86C202, "SIS86c202" }, - { PCI_CHIP_SG86C205, "SIS86c205" }, - { PCI_CHIP_SG86C215, "SIS86c215" }, - { PCI_CHIP_SG86C225, "SIS86c225" }, + { PCI_CHIP_SG86C201, "SIS86c201" }, + { PCI_CHIP_SG86C202, "SIS86c202" }, + { PCI_CHIP_SG86C205, "SIS86c205" }, + { PCI_CHIP_SG86C215, "SIS86c215" }, + { PCI_CHIP_SG86C225, "SIS86c225" }, #endif - { PCI_CHIP_SIS5597, "SIS5597" }, - { PCI_CHIP_SIS5597, "SIS5598" }, - { PCI_CHIP_SIS530, "SIS530" }, - { PCI_CHIP_SIS6326, "SIS6326" }, - { PCI_CHIP_SIS300, "SIS300" }, - { PCI_CHIP_SIS630, "SIS630" }, - { PCI_CHIP_SIS540, "SIS540" }, - { -1, NULL } + { PCI_CHIP_SIS5597, "SIS5597" }, + { PCI_CHIP_SIS5597, "SIS5598" }, + { PCI_CHIP_SIS530, "SIS530" }, + { PCI_CHIP_SIS6326, "SIS6326" }, + { PCI_CHIP_SIS300, "SIS300" }, + { PCI_CHIP_SIS630, "SIS630" }, + { PCI_CHIP_SIS540, "SIS540" }, + { -1, NULL } }; static PciChipsets SISPciChipsets[] = { #if 0 - { PCI_CHIP_SG86C201, PCI_CHIP_SG86C201, RES_SHARED_VGA }, - { PCI_CHIP_SG86C202, PCI_CHIP_SG86C202, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, + { PCI_CHIP_SG86C201, PCI_CHIP_SG86C201, RES_SHARED_VGA }, + { PCI_CHIP_SG86C202, PCI_CHIP_SG86C202, RES_SHARED_VGA }, + { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, + { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, #endif - { PCI_CHIP_SIS5597, PCI_CHIP_SIS5597, RES_SHARED_VGA }, - { PCI_CHIP_SIS530, PCI_CHIP_SIS530, RES_SHARED_VGA }, - { PCI_CHIP_SIS6326, PCI_CHIP_SIS6326, RES_SHARED_VGA }, - { PCI_CHIP_SIS300, PCI_CHIP_SIS300, RES_SHARED_VGA }, - { PCI_CHIP_SIS630, PCI_CHIP_SIS630, RES_SHARED_VGA }, - { PCI_CHIP_SIS540, PCI_CHIP_SIS540, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } + { PCI_CHIP_SIS5597, PCI_CHIP_SIS5597, RES_SHARED_VGA }, + { PCI_CHIP_SIS530, PCI_CHIP_SIS530, RES_SHARED_VGA }, + { PCI_CHIP_SIS6326, PCI_CHIP_SIS6326, RES_SHARED_VGA }, + { PCI_CHIP_SIS300, PCI_CHIP_SIS300, RES_SHARED_VGA }, + { PCI_CHIP_SIS630, PCI_CHIP_SIS630, RES_SHARED_VGA }, + { PCI_CHIP_SIS540, PCI_CHIP_SIS540, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } }; int sisReg32MMIO[]={0x8280,0x8284,0x8288,0x828C,0x8290,0x8294,0x8298,0x829C, - 0x82A0,0x82A4,0x82A8,0x82AC}; + 0x82A0,0x82A4,0x82A8,0x82AC}; /* Engine Register for the 2nd Generation Graphics Engine */ int sis2Reg32MMIO[]={0x8200,0x8204,0x8208,0x820C,0x8210,0x8214,0x8218,0x821C, - 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, - 0x8240, 0x8300}; + 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, + 0x8240, 0x8300}; static const char *xaaSymbols[] = { "XAADestroyInfoRec", @@ -214,22 +218,63 @@ static const char *i2cSymbols[] = { NULL }; +#ifdef XF86DRI +static const char *drmSymbols[] = { + "drmAddBufs", + "drmAddMap", + "drmAvailable", + "drmCtlAddCommand", + "drmCtlInstHandler", + "drmGetInterruptFromBusID", + "drmMapBufs", + "drmMarkBufs", + "drmUnmapBufs", + "drmAgpAcquire", + "drmAgpRelease", + "drmAgpEnable", + "drmAgpAlloc", + "drmAgpFree", + "drmAgpBind", + "drmAgpGetMode", + "drmAgpBase", + "drmAgpSize", + NULL +}; + +static const char *driSymbols[] = { + "DRIGetDrawableIndex", + "DRIFinishScreenInit", + "DRIDestroyInfoRec", + "DRICloseScreen", + "DRIDestroyInfoRec", + "DRIScreenInit", + "DRIDestroyInfoRec", + "DRICreateInfoRec", + "DRILock", + "DRIUnlock", + "DRIGetSAREAPrivate", + "DRIGetContext", + "GlxSetVisualConfigs", + NULL +}; +#endif + #ifdef XFree86LOADER static MODULESETUPPROTO(sisSetup); static XF86ModuleVersionInfo sisVersRec = { - "sis", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - SIS_MAJOR_VERSION, SIS_MINOR_VERSION, SIS_PATCHLEVEL, - ABI_CLASS_VIDEODRV, /* This is a video driver */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_VIDEODRV, - {0,0,0,0} + "sis", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + SIS_MAJOR_VERSION, SIS_MINOR_VERSION, SIS_PATCHLEVEL, + ABI_CLASS_VIDEODRV, /* This is a video driver */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0,0,0,0} }; XF86ModuleData sisModuleData = { &sisVersRec, sisSetup, NULL }; @@ -240,13 +285,15 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) static Bool setupDone = FALSE; if (!setupDone) { - setupDone = TRUE; - xf86AddDriver(&SIS, module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, - NULL); - return (pointer)TRUE; + setupDone = TRUE; + xf86AddDriver(&SIS, module, 0); + LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, +#ifdef XF86DRI + drmSymbols, driSymbols, +#endif + NULL); + return (pointer)TRUE; } -ErrorF("sisSetup\n"); if (errmaj) *errmaj = LDR_ONCEONLY; return NULL; @@ -263,7 +310,7 @@ SISGetRec(ScrnInfoPtr pScrn) * the allocation has already been done. */ if (pScrn->driverPrivate != NULL) - return TRUE; + return TRUE; pScrn->driverPrivate = xnfcalloc(sizeof(SISRec), 1); /* Initialise it */ @@ -275,7 +322,7 @@ static void SISFreeRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate == NULL) - return; + return; xfree(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } @@ -284,52 +331,52 @@ SISFreeRec(ScrnInfoPtr pScrn) static void SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { - unsigned char extDDC_PCR; - unsigned char crtc17 = 0; - unsigned char seq1 = 0 ; + unsigned char extDDC_PCR; + unsigned char crtc17 = 0; + unsigned char seq1 = 0 ; int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,"SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); - outb(vgaIOBase + 4, 0x17); - crtc17 = inb(vgaIOBase + 5); - outb(VGA_SEQ_INDEX, 0x11); - extDDC_PCR = inb(VGA_SEQ_DATA) & ~0xC0; - switch (PowerManagementMode) - { - case DPMSModeOn: - /* HSync: On, VSync: On */ - seq1 = 0x00 ; - crtc17 |= 0x80; - break; - case DPMSModeStandby: - /* HSync: Off, VSync: On */ - seq1 = 0x20 ; - extDDC_PCR |= 0x40; - break; - case DPMSModeSuspend: - /* HSync: On, VSync: Off */ - seq1 = 0x20 ; - extDDC_PCR |= 0x80; - break; - case DPMSModeOff: - /* HSync: Off, VSync: Off */ - seq1 = 0x20 ; - extDDC_PCR |= 0xC0; - /* DPMSModeOff is not supported with ModeStandby | ModeSuspend */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,"SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); + outb(vgaIOBase + 4, 0x17); + crtc17 = inb(vgaIOBase + 5); + outb(VGA_SEQ_INDEX, 0x11); + extDDC_PCR = inb(VGA_SEQ_DATA) & ~0xC0; + switch (PowerManagementMode) + { + case DPMSModeOn: + /* HSync: On, VSync: On */ + seq1 = 0x00 ; + crtc17 |= 0x80; + break; + case DPMSModeStandby: + /* HSync: Off, VSync: On */ + seq1 = 0x20 ; + extDDC_PCR |= 0x40; + break; + case DPMSModeSuspend: + /* HSync: On, VSync: Off */ + seq1 = 0x20 ; + extDDC_PCR |= 0x80; + break; + case DPMSModeOff: + /* HSync: Off, VSync: Off */ + seq1 = 0x20 ; + extDDC_PCR |= 0xC0; + /* DPMSModeOff is not supported with ModeStandby | ModeSuspend */ /* need same as the generic VGA function */ - crtc17 &= ~0x80; - break; - } - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ - outb(VGA_SEQ_INDEX, 0x01); /* Select SEQ1 */ - seq1 |= inb(VGA_SEQ_DATA) & ~0x20; - outb(VGA_SEQ_DATA, seq1); - usleep(10000); - outb(vgaIOBase + 4, 0x17); - outb(vgaIOBase + 5, crtc17); - outb(VGA_SEQ_INDEX, 0x11); - outb(VGA_SEQ_DATA, extDDC_PCR); - outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ + crtc17 &= ~0x80; + break; + } + outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ + outb(VGA_SEQ_INDEX, 0x01); /* Select SEQ1 */ + seq1 |= inb(VGA_SEQ_DATA) & ~0x20; + outb(VGA_SEQ_DATA, seq1); + usleep(10000); + outb(vgaIOBase + 4, 0x17); + outb(vgaIOBase + 5, crtc17); + outb(VGA_SEQ_INDEX, 0x11); + outb(VGA_SEQ_DATA, extDDC_PCR); + outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ } #endif @@ -338,7 +385,7 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla static void SISIdentify(int flags) { - xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); + xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); } static void @@ -386,12 +433,12 @@ SISProbe(DriverPtr drv, int flags) */ if ((numDevSections = xf86MatchDevice(SIS_DRIVER_NAME, - &devSections)) <= 0) { - /* - * There's no matching device section in the config file, so quit - * now. - */ - return FALSE; + &devSections)) <= 0) { + /* + * There's no matching device section in the config file, so quit + * now. + */ + return FALSE; } /* @@ -410,50 +457,50 @@ SISProbe(DriverPtr drv, int flags) * amounts to checking the PCI data that the server has already collected. */ if (xf86GetPciVideoInfo() == NULL) { - /* - * We won't let anything in the config file override finding no - * PCI video cards at all. This seems reasonable now, but we'll see. - */ - return FALSE; + /* + * We won't let anything in the config file override finding no + * PCI video cards at all. This seems reasonable now, but we'll see. + */ + return FALSE; } numUsed = xf86MatchPciInstances(SIS_NAME, PCI_VENDOR_SIS, - SISChipsets, SISPciChipsets, devSections, - numDevSections, drv, &usedChips); + SISChipsets, SISPciChipsets, devSections, + numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ if (devSections) xfree(devSections); devSections = NULL; if (numUsed <= 0) - return FALSE; + return FALSE; if (flags & PROBE_DETECT) foundScreen = TRUE; else for (i = 0; i < numUsed; i++) { - ScrnInfoPtr pScrn; - - /* Allocate a ScrnInfoRec and claim the slot */ - pScrn = NULL; - - if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - SISPciChipsets, NULL, NULL, - NULL, NULL, NULL))) { - /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = SIS_CURRENT_VERSION; - pScrn->driverName = SIS_DRIVER_NAME; - pScrn->name = SIS_NAME; - pScrn->Probe = SISProbe; - pScrn->PreInit = SISPreInit; - pScrn->ScreenInit = SISScreenInit; - pScrn->SwitchMode = SISSwitchMode; - pScrn->AdjustFrame = SISAdjustFrame; - pScrn->EnterVT = SISEnterVT; - pScrn->LeaveVT = SISLeaveVT; - pScrn->FreeScreen = SISFreeScreen; - pScrn->ValidMode = SISValidMode; - foundScreen = TRUE; - } + ScrnInfoPtr pScrn; + + /* Allocate a ScrnInfoRec and claim the slot */ + pScrn = NULL; + + if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + SISPciChipsets, NULL, NULL, + NULL, NULL, NULL))) { + /* Fill in what we can of the ScrnInfoRec */ + pScrn->driverVersion = SIS_CURRENT_VERSION; + pScrn->driverName = SIS_DRIVER_NAME; + pScrn->name = SIS_NAME; + pScrn->Probe = SISProbe; + pScrn->PreInit = SISPreInit; + pScrn->ScreenInit = SISScreenInit; + pScrn->SwitchMode = SISSwitchMode; + pScrn->AdjustFrame = SISAdjustFrame; + pScrn->EnterVT = SISEnterVT; + pScrn->LeaveVT = SISLeaveVT; + pScrn->FreeScreen = SISFreeScreen; + pScrn->ValidMode = SISValidMode; + foundScreen = TRUE; + } } xfree(usedChips); return foundScreen; @@ -486,7 +533,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) ClockRangePtr clockRanges; char *mod = NULL; const char *Sym = NULL; - int pix24flags; + int pix24flags; if (flags & PROBE_DETECT) return FALSE; @@ -505,11 +552,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Check the number of entities, and fail if it isn't one. */ if (pScrn->numEntities != 1) - return FALSE; + return FALSE; /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) - return FALSE; + return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); @@ -517,18 +564,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) - return FALSE; + return FALSE; - VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ + VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ if (!vgaHWMapMem(pScrn)) - return FALSE; + return FALSE; vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* Allocate the SISRec driverPrivate */ if (!SISGetRec(pScrn)) { - return FALSE; + return FALSE; } pSiS = SISPTR(pScrn); pSiS->pScrn = pScrn; @@ -536,23 +583,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Get the entity, and make sure it is PCI. */ pSiS->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (pSiS->pEnt->location.type != BUS_PCI) - return FALSE; + return FALSE; /* Find the PCI info for this screen */ pSiS->PciInfo = xf86GetPciInfoForEntity(pSiS->pEnt->index); pSiS->PciTag = pciTag(pSiS->PciInfo->bus, pSiS->PciInfo->device, - pSiS->PciInfo->func); + pSiS->PciInfo->func); /* * XXX This could be refined if some VGA memory resources are not * decoded in operating mode. */ { - resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - _END }; - xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr); + resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, + {ResShrMemBlock,0xB0000,0xB7FFF}, + {ResShrMemBlock,0xB8000,0xBFFFF}, + _END }; + xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr); } /* Operations for which memory access is required */ @@ -562,7 +609,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* The ramdac module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "ramdac")) - return FALSE; + return FALSE; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -573,59 +620,59 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * Our preference for depth 24 is 24bpp, so tell it that too. */ pix24flags = Support32bppFb | Support24bppFb | - SupportConvert24to32 | SupportConvert32to24; + SupportConvert24to32 | SupportConvert32to24; if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) { - return FALSE; + return FALSE; } else { - /* Check that the returned depth is one we support */ - switch (pScrn->depth) { - case 8: - case 15: - case 16: - case 24: - /* OK */ - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this driver\n", - pScrn->depth); - return FALSE; - } + /* Check that the returned depth is one we support */ + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + /* OK */ + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); + return FALSE; + } } xf86PrintDepthBpp(pScrn); /* Get the depth24 pixmap format */ if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); + pix24bpp = xf86GetBppFromDepth(pScrn, 24); /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. */ if (pScrn->depth > 8) { - /* The defaults are OK for us */ - rgb zeros = {0, 0, 0}; + /* The defaults are OK for us */ + rgb zeros = {0, 0, 0}; - if (!xf86SetWeight(pScrn, zeros, zeros)) { - return FALSE; - } else { - /* XXX check that weight returned is supported */ + if (!xf86SetWeight(pScrn, zeros, zeros)) { + return FALSE; + } else { + /* XXX check that weight returned is supported */ ; } } if (!xf86SetDefaultVisual(pScrn, -1)) { - return FALSE; + return FALSE; } else { - /* We don't currently support DirectColor at > 8bpp */ - if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" - " (%s) is not supported at depth %d\n", - xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); - return FALSE; - } + /* We don't currently support DirectColor at > 8bpp */ + if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" + " (%s) is not supported at depth %d\n", + xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + return FALSE; + } } /* @@ -633,11 +680,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) */ { - Gamma zeros = {0.0, 0.0, 0.0}; + Gamma zeros = {0.0, 0.0, 0.0}; - if (!xf86SetGamma(pScrn, zeros)) { - return FALSE; - } + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } } /* We use a programamble clock */ @@ -645,11 +692,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Set the bits per RGB for 8bpp mode */ if (pScrn->depth == 8) { - pScrn->rgbBits = 6; + pScrn->rgbBits = 6; } - pSiS->ddc1Read = SiSddc1Read; /* this cap will be modified */ + pSiS->ddc1Read = SiSddc1Read; /* this cap will be modified */ from = X_DEFAULT; /* @@ -657,27 +704,27 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * override. */ if (pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) { - pScrn->chipset = pSiS->pEnt->device->chipset; - pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset); - from = X_CONFIG; + pScrn->chipset = pSiS->pEnt->device->chipset; + pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset); + from = X_CONFIG; } else if (pSiS->pEnt->device->chipID >= 0) { - pSiS->Chipset = pSiS->pEnt->device->chipID; - pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); + pSiS->Chipset = pSiS->pEnt->device->chipID; + pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); - from = X_CONFIG; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", - pSiS->Chipset); + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pSiS->Chipset); } else { - from = X_PROBED; - pSiS->Chipset = pSiS->PciInfo->chipType; - pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); + from = X_PROBED; + pSiS->Chipset = pSiS->PciInfo->chipType; + pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); } if (pSiS->pEnt->device->chipRev >= 0) { - pSiS->ChipRev = pSiS->pEnt->device->chipRev; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", - pSiS->ChipRev); + pSiS->ChipRev = pSiS->pEnt->device->chipRev; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + pSiS->ChipRev); } else { - pSiS->ChipRev = pSiS->PciInfo->chipRev; + pSiS->ChipRev = pSiS->PciInfo->chipRev; } /* @@ -685,14 +732,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * SISProbe(), but check it just in case. */ if (pScrn->chipset == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "ChipID 0x%04X is not recognised\n", pSiS->Chipset); - return FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ChipID 0x%04X is not recognised\n", pSiS->Chipset); + return FALSE; } if (pSiS->Chipset < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Chipset \"%s\" is not recognised\n", pScrn->chipset); - return FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Chipset \"%s\" is not recognised\n", pScrn->chipset); + return FALSE; } @@ -701,13 +748,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* get VBIOS image */ if (!(pSiS->BIOS=xcalloc(1, BIOS_SIZE))) { - ErrorF("Allocate memory fail !!\n"); - return FALSE; + ErrorF("Allocate memory fail !!\n"); + return FALSE; } if (xf86ReadBIOS(BIOS_BASE, 0, pSiS->BIOS, BIOS_SIZE) != BIOS_SIZE) { - xfree(pSiS->BIOS); - ErrorF("Read VBIOS image fail !!\n"); - return FALSE; + xfree(pSiS->BIOS); + ErrorF("Read VBIOS image fail !!\n"); + return FALSE; } SiSOptions(pScrn); @@ -715,49 +762,49 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) from = X_PROBED; if (pSiS->pEnt->device->MemBase != 0) { - /* - * XXX Should check that the config file value matches one of the - * PCI base address values. - */ - pSiS->FbAddress = pSiS->pEnt->device->MemBase; - from = X_CONFIG; + /* + * XXX Should check that the config file value matches one of the + * PCI base address values. + */ + pSiS->FbAddress = pSiS->pEnt->device->MemBase; + from = X_CONFIG; } else { - pSiS->FbAddress = pSiS->PciInfo->memBase[0] & 0xFFFFFFF0; + pSiS->FbAddress = pSiS->PciInfo->memBase[0] & 0xFFFFFFF0; } xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", - (unsigned long)pSiS->FbAddress); + (unsigned long)pSiS->FbAddress); if (pSiS->pEnt->device->IOBase != 0) { - /* - * XXX Should check that the config file value matches one of the - * PCI base address values. - */ - pSiS->IOAddress = pSiS->pEnt->device->IOBase; - from = X_CONFIG; + /* + * XXX Should check that the config file value matches one of the + * PCI base address values. + */ + pSiS->IOAddress = pSiS->pEnt->device->IOBase; + from = X_CONFIG; } else { - pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; + pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; } xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", - (unsigned long)pSiS->IOAddress); + (unsigned long)pSiS->IOAddress); pSiS->RelIO = pSiS->PciInfo->ioBase[2] & 0xFFFC; xf86DrvMsg(pScrn->scrnIndex, from, "Relocate IO registers at 0x%lX\n", - (unsigned long)pSiS->RelIO); + (unsigned long)pSiS->RelIO); /* Register the PCI-assigned resources. */ if (xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "xf86RegisterResources() found resource conflicts\n"); - return FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86RegisterResources() found resource conflicts\n"); + return FALSE; } from = X_PROBED; if ((pSiS->pEnt->device->videoRam != 0) && - (pSiS->pEnt->device->videoRam < pScrn->videoRam)) { - pScrn->videoRam = pSiS->pEnt->device->videoRam; - from = X_CONFIG; + (pSiS->pEnt->device->videoRam < pScrn->videoRam)) { + pScrn->videoRam = pSiS->pEnt->device->videoRam; + from = X_CONFIG; } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", @@ -766,16 +813,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->FbMapSize = pScrn->videoRam * 1024; SISVGAPreInit(pScrn); - SISLCDPreInit(pScrn); - SISTVPreInit(pScrn); + SISLCDPreInit(pScrn); + SISTVPreInit(pScrn); + SISCRT2PreInit(pScrn); SISDACPreInit(pScrn); outw(VGA_SEQ_INDEX, (unlock << 8) | 0x05); /* Set the min pixel clock */ - pSiS->MinClock = 16250; /* XXX Guess, need to check this */ + pSiS->MinClock = 16250; /* XXX Guess, need to check this */ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n", - pSiS->MinClock / 1000); + pSiS->MinClock / 1000); from = X_PROBED; /* @@ -783,30 +831,30 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * file, we respect that setting. */ if (pSiS->pEnt->device->dacSpeeds[0]) { - int speed = 0; - - switch (pScrn->bitsPerPixel) { - case 8: - speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP8]; - break; - case 16: - speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP16]; - break; - case 24: - speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP24]; - break; - case 32: - speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP32]; - break; - } - if (speed == 0) - pSiS->MaxClock = pSiS->pEnt->device->dacSpeeds[0]; - else - pSiS->MaxClock = speed; - from = X_CONFIG; + int speed = 0; + + switch (pScrn->bitsPerPixel) { + case 8: + speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP8]; + break; + case 16: + speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP16]; + break; + case 24: + speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP24]; + break; + case 32: + speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP32]; + break; + } + if (speed == 0) + pSiS->MaxClock = pSiS->pEnt->device->dacSpeeds[0]; + else + pSiS->MaxClock = speed; + from = X_CONFIG; } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", - pSiS->MaxClock / 1000); + pSiS->MaxClock / 1000); /* * Setup the ClockRanges, which describe what clock ranges are available, @@ -816,9 +864,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) clockRanges->next = NULL; clockRanges->minClock = pSiS->MinClock; clockRanges->maxClock = pSiS->MaxClock; - clockRanges->clockIndex = -1; /* programmable */ + clockRanges->clockIndex = -1; /* programmable */ clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; /* XXX check this */ + clockRanges->doubleScanAllowed = TRUE; /* XXX check this */ /* * xf86ValidateModes will check that the mode HTotal and VTotal values @@ -833,26 +881,26 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * XXX Assuming min height 128, max 4096 */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, - pScrn->display->modes, clockRanges, - NULL, 256, 8192, - pScrn->bitsPerPixel * 8, 128, 4096, - pScrn->display->virtualX, - pScrn->display->virtualY, - pSiS->FbMapSize, - LOOKUP_BEST_REFRESH); + pScrn->display->modes, clockRanges, + NULL, 256, 8192, + pScrn->bitsPerPixel * 8, 128, 4096, + pScrn->display->virtualX, + pScrn->display->virtualY, + pSiS->FbMapSize, + LOOKUP_BEST_REFRESH); if (i == -1) { - SISFreeRec(pScrn); - return FALSE; + SISFreeRec(pScrn); + return FALSE; } /* Prune the modes marked as invalid */ xf86PruneDriverModes(pScrn); if (i == 0 || pScrn->modes == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); - SISFreeRec(pScrn); - return FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + SISFreeRec(pScrn); + return FALSE; } xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); @@ -869,57 +917,57 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { case 1: - mod = "xf1bpp"; - Sym = "xf1bppScreenInit"; - break; + mod = "xf1bpp"; + Sym = "xf1bppScreenInit"; + break; case 4: - mod = "xf4bpp"; - Sym = "xf4bppScreenInit"; - break; + mod = "xf4bpp"; + Sym = "xf4bppScreenInit"; + break; case 8: - mod = "cfb"; - Sym = "cfbScreenInit"; - break; + mod = "cfb"; + Sym = "cfbScreenInit"; + break; case 16: - mod = "cfb16"; - Sym = "cfb16ScreenInit"; - break; + mod = "cfb16"; + Sym = "cfb16ScreenInit"; + break; case 24: - if (pix24bpp == 24) { - mod = "cfb24"; - Sym = "cfb24ScreenInit"; - } else { - mod = "xf24_32bpp"; - Sym = "cfb24_32ScreenInit"; - } - break; + if (pix24bpp == 24) { + mod = "cfb24"; + Sym = "cfb24ScreenInit"; + } else { + mod = "xf24_32bpp"; + Sym = "cfb24_32ScreenInit"; + } + break; case 32: - mod = "cfb32"; - Sym = "cfb32ScreenInit"; - break; + mod = "cfb32"; + Sym = "cfb32ScreenInit"; + break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - SISFreeRec(pScrn); - return FALSE; + SISFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymbols(Sym, NULL); if (!xf86LoadSubModule(pScrn, "i2c")) { - SISFreeRec(pScrn); - return FALSE; + SISFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymLists(i2cSymbols, NULL); /* Load XAA if needed */ if (!pSiS->NoAccel) { - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Accel Enable\n"); - if (!xf86LoadSubModule(pScrn, "xaa")) { - SISFreeRec(pScrn); - return FALSE; - } + xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Accel Enable\n"); + if (!xf86LoadSubModule(pScrn, "xaa")) { + SISFreeRec(pScrn); + return FALSE; + } xf86LoaderReqSymLists(xaaSymbols, NULL); } @@ -927,14 +975,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Load DDC if needed */ /* This gives us DDC1 - we should be able to get DDC2B using i2c */ if (!xf86LoadSubModule(pScrn, "ddc")) { - SISFreeRec(pScrn); - return FALSE; + SISFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymLists(ddcSymbols, NULL); /* Initialize DDC1 if possible */ - if (pSiS->ddc1Read) - xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ) ); +/* if (pSiS->ddc1Read) + xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ) ); */ return TRUE; @@ -966,9 +1014,9 @@ SISMapMem(ScrnInfoPtr pScrn) mmioFlags = VIDMEM_MMIO | VIDMEM_SPARSE; #endif pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, 0x10000); if (pSiS->IOBase == NULL) - return FALSE; + return FALSE; #ifdef __alpha__ /* @@ -976,18 +1024,18 @@ SISMapMem(ScrnInfoPtr pScrn) * setting CPUToScreenColorExpandBase. */ pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, 0x10000); if (pSiS->IOBaseDense == NULL) - return FALSE; + return FALSE; #endif /* __alpha__ */ pSiS->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pSiS->PciTag, - (unsigned long)pSiS->FbAddress, - pSiS->FbMapSize); + pSiS->PciTag, + (unsigned long)pSiS->FbAddress, + pSiS->FbMapSize); if (pSiS->FbBase == NULL) - return FALSE; + return FALSE; return TRUE; } @@ -1055,41 +1103,45 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) SISRegPtr sisReg; vgaHWUnlock(hwp); - - SISModifyModeInfo(mode); + + SISModifyModeInfo(mode); /* Initialise the ModeReg values */ if (!vgaHWInit(pScrn, mode)) - return FALSE; - pScrn->vtSema = TRUE; + return FALSE; + pScrn->vtSema = TRUE; if (!(*pSiS->ModeInit)(pScrn, mode)) return FALSE; - if (pSiS->VBFlags & CRT2_ENABLE) - if (!(*pSiS->ModeInit2)(pScrn, mode)) { /* Disable VB */ - pSiS->ModeReg.sisRegs3D4[0x31] |= 0x60; - pSiS->ModeReg.sisRegs3D4[0x30] &= 0xFC; - } - PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "HDisplay: %d, VDisplay: %d \n", - mode->HDisplay, mode->VDisplay)); + "HDisplay: %d, VDisplay: %d \n", + mode->HDisplay, mode->VDisplay)); /* Program the registers */ vgaHWProtect(pScrn, TRUE); vgaReg = &hwp->ModeReg; - sisReg = &pSiS->ModeReg; + sisReg = &pSiS->ModeReg; vgaReg->Attribute[0x10] = 0x01; if (pScrn->bitsPerPixel > 8) - vgaReg->Graphics[0x05] = 0x00; + vgaReg->Graphics[0x05] = 0x00; - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - (*pSiS->SiSRestore)(pScrn, sisReg); + if( (pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540) ) + { + SiSPreSetMode(pScrn); + SiSSetMode(pScrn, pScrn->currentMode); + } + else + { + (*pSiS->SiSRestore)(pScrn, sisReg); + } - vgaHWProtect(pScrn, FALSE); + vgaHWProtect(pScrn, FALSE); /* Reserved for debug * @@ -1139,6 +1191,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SISPtr pSiS; int ret; VisualPtr visual; + unsigned long OnScreenSize; /* * First get the ScrnInfoRec @@ -1147,18 +1200,18 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) hwp = VGAHWPTR(pScrn); - hwp->MapSize = 0x10000; /* Standard 64k VGA window */ + hwp->MapSize = 0x10000; /* Standard 64k VGA window */ pSiS = SISPTR(pScrn); /* Map the VGA memory and get the VGA IO base */ if (!vgaHWMapMem(pScrn)) - return FALSE; + return FALSE; vgaHWGetIOBase(hwp); /* Map the SIS memory and MMIO areas */ if (!SISMapMem(pScrn)) - return FALSE; + return FALSE; /* Save the current state */ SISSave(pScrn); @@ -1168,7 +1221,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Initialise the first mode */ if (!SISModeInit(pScrn, pScrn->currentMode)) - return FALSE; + return FALSE; + + /* Clear frame buffer */ + OnScreenSize = pScrn->displayWidth * pScrn->currentMode->VDisplay * (pScrn->bitsPerPixel / 8); + memset(pSiS->FbBase, 0, OnScreenSize); /* Darken the screen for aesthetic reasons and set the viewport */ SISSaveScreen(pScreen, SCREEN_SAVER_ON); @@ -1199,16 +1256,35 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) */ if (pScrn->bitsPerPixel > 8) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, - pScrn->defaultVisual)) - return FALSE; + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, + pScrn->defaultVisual)) + return FALSE; } else { - if (!miSetVisualTypes(pScrn->depth, - miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; } + { + static int GlobalHWQueueLength = 0; + + pSiS->cmdQueueLenPtr = &(GlobalHWQueueLength); + } + +#ifdef XF86DRI + /* + * Setup DRI after visuals have been established, but before cfbScreenInit + * is called. cfbScreenInit will eventually call into the drivers + * InitGLXVisuals call back. + */ + pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); + /* Force the initialization of the context */ +#if 0 + SISLostContext(pScreen); +#endif +#endif + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -1216,51 +1292,51 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) switch (pScrn->bitsPerPixel) { case 1: - ret = xf1bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + ret = xf1bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 4: - ret = xf4bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + ret = xf4bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 8: - ret = cfbScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + ret = cfbScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 16: - ret = cfb16ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + ret = cfb16ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 24: - if (pix24bpp == 24) - ret = cfb24ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - else - ret = cfb24_32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + if (pix24bpp == 24) + ret = cfb24ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + else + ret = cfb24_32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 32: - ret = cfb32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; + ret = cfb32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; default: - xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in SISScrnInit\n", - pScrn->bitsPerPixel); - ret = FALSE; - break; + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: invalid bpp (%d) in SISScrnInit\n", + pScrn->bitsPerPixel); + ret = FALSE; + break; } if (!ret) { - ErrorF ("SetMode Error@!\n"); - return FALSE; + ErrorF ("SetMode Error@!\n"); + return FALSE; } xf86SetBlackWhitePixels(pScreen); @@ -1271,28 +1347,28 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { - if ((visual->class | DynamicClass) == DirectColor) { - visual->offsetRed = pScrn->offset.red; - visual->offsetGreen = pScrn->offset.green; - visual->offsetBlue = pScrn->offset.blue; - visual->redMask = pScrn->mask.red; - visual->greenMask = pScrn->mask.green; - visual->blueMask = pScrn->mask.blue; - } - } + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } } else if (pScrn->depth == 1) { - SIS1bppColorMap(pScrn); + SIS1bppColorMap(pScrn); } if (!pSiS->NoAccel) { if ( pSiS->Chipset == PCI_CHIP_SIS300 || - pSiS->Chipset == PCI_CHIP_SIS630 || - pSiS->Chipset == PCI_CHIP_SIS540) - SiS300AccelInit(pScreen); - else if (pSiS->Chipset == PCI_CHIP_SIS530) - SiS530AccelInit(pScreen); - else - SiSAccelInit(pScreen); + pSiS->Chipset == PCI_CHIP_SIS630 || + pSiS->Chipset == PCI_CHIP_SIS540) + SiS300AccelInit(pScreen); + else if (pSiS->Chipset == PCI_CHIP_SIS530) + SiS530AccelInit(pScreen); + else + SiSAccelInit(pScreen); } miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -1301,32 +1377,48 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); if (pSiS->HWCursor) - SiSHWCursorInit(pScreen); + SiSHWCursorInit(pScreen); /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) - return FALSE; + return FALSE; -/* marked by archer for adding VB palette +/* marked by archer for adding VB palette if (!vgaHWHandleColormaps(pScreen)) - return FALSE; + return FALSE; */ if (!xf86HandleColormaps(pScreen, 256, 8, SISLoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; #ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); #endif +#ifdef XF86DRI + if (pSiS->directRenderingEnabled) { + /* Now that mi, cfb, drm and others have done their thing, + * complete the DRI setup. + */ + pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen); + } + if (pSiS->directRenderingEnabled) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); + /* TODO */ + /* SISSetLFBConfig(pSiS); */ + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n"); + } +#endif + pSiS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SISCloseScreen; pScreen->SaveScreen = SISSaveScreen; /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { - xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* Turn on the screen now */ @@ -1340,7 +1432,18 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - return SISModeInit(xf86Screens[scrnIndex], mode); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + if( (pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540) ) + { + return SiSSetMode(xf86Screens[scrnIndex], mode); + } + else + { + return SISModeInit(xf86Screens[scrnIndex], mode); + } } @@ -1349,7 +1452,7 @@ SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) * displayed location in the video memory. */ /* Usually mandatory */ -void +void SISAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -1368,52 +1471,54 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags) outw(VGA_SEQ_INDEX, 0x8605); if (pScrn->bitsPerPixel < 8) { - base = (y * pScrn->displayWidth + x + 3) >> 3; + base = (y * pScrn->displayWidth + x + 3) >> 3; } else { - base = y * pScrn->displayWidth + x ; - /* calculate base bpp dep. */ - switch (pScrn->bitsPerPixel) { - case 16: - base >>= 1; - break; - case 24: - base = ((base * 3)) >> 2; - base -= base % 6; - break; - case 32: - break; - default: /* 8bpp */ - base >>= 2; - break; - } + base = y * pScrn->displayWidth + x ; + /* calculate base bpp dep. */ + switch (pScrn->bitsPerPixel) { + case 16: + base >>= 1; + break; + case 24: + base = ((base * 3)) >> 2; + base -= base % 6; + break; + case 32: + break; + default: /* 8bpp */ + base >>= 2; + break; + } } outw(vgaIOBase + 4, (base & 0x00FF00) | 0x0C); outw(vgaIOBase + 4, ((base & 0x00FF) << 8) | 0x0D); switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - outb(VGA_SEQ_INDEX, 0x0D); - temp = (base & 0xFF0000) >> 16; - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); - outb(VGA_SEQ_DATA, temp); - if (pSiS->VBFlags) { - UnLockCRT2(pSiS->RelIO); - outSISIDXREG(pSiS->RelIO+4, 6, GETVAR8(base)); - outSISIDXREG(pSiS->RelIO+4, 5, GETBITS(base, 15:8)); - outSISIDXREG(pSiS->RelIO+4, 4, GETBITS(base, 23:16)); - LockCRT2(pSiS->RelIO); - } - break; - default: - outb(VGA_SEQ_INDEX, 0x27); - temp = inb(VGA_SEQ_DATA) & 0xF0; - temp |= (base & 0x0F0000) >> 16; - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/27h set to hex %2X, base %d\n", temp, base)); - outb(VGA_SEQ_DATA, temp); + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + outb(VGA_SEQ_INDEX, 0x0D); + temp = (base & 0xFF0000) >> 16; + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); + outb(VGA_SEQ_DATA, temp); + if (pSiS->VBFlags) { +/* UnLockCRT2VB(pSiS->RelIO); */ + UnLockCRT2(pSiS->RelIO+0x30); + outSISIDXREG(pSiS->RelIO+4, 6, GETVAR8(base)); + outSISIDXREG(pSiS->RelIO+4, 5, GETBITS(base, 15:8)); + outSISIDXREG(pSiS->RelIO+4, 4, GETBITS(base, 23:16)); +/* LockCRT2VB(pSiS->RelIO); */ + LockCRT2(pSiS->RelIO+0x30); + } + break; + default: + outb(VGA_SEQ_INDEX, 0x27); + temp = inb(VGA_SEQ_DATA) & 0xF0; + temp |= (base & 0x0F0000) >> 16; + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "3C5/27h set to hex %2X, base %d\n", temp, base)); + outb(VGA_SEQ_DATA, temp); } outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ @@ -1431,10 +1536,33 @@ static Bool SISEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + +#ifdef XF86DRI + ScreenPtr pScreen; +#endif + +#ifdef XF86DRI + if (pSiS->directRenderingEnabled) { + pScreen = screenInfo.screens[scrnIndex]; + DRIUnlock(pScreen); + } +#endif /* Should we re-save the text mode on each VT enter? */ - if (!SISModeInit(pScrn, pScrn->currentMode)) - return FALSE; + if( (pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540) ) + { + SiSPreSetMode(pScrn); + if (!SiSSetMode(pScrn, pScrn->currentMode)) + return FALSE; + } + else + { + if (!SISModeInit(pScrn, pScrn->currentMode)) + return FALSE; + } SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -1456,8 +1584,22 @@ SISLeaveVT(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); +#ifdef XF86DRI + ScreenPtr pScreen; + SISPtr pSiS; +#endif + SISRestore(pScrn); vgaHWLock(hwp); + +#ifdef XF86DRI + pSiS = SISPTR(pScrn); + if (pSiS->directRenderingEnabled) { + pScreen = screenInfo.screens[scrnIndex]; + DRILock(pScreen, 0); + } +#endif + } @@ -1473,20 +1615,26 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); SISPtr pSiS = SISPTR(pScrn); - xf86CursorInfoPtr pCursorInfo = pSiS->CursorInfoPtr; + xf86CursorInfoPtr pCursorInfo = pSiS->CursorInfoPtr; - if (pCursorInfo) - pCursorInfo->HideCursor(pScrn); +#ifdef XF86DRI + if (pSiS->directRenderingEnabled) { + SISDRICloseScreen(pScreen); + pSiS->directRenderingEnabled=FALSE; + } +#endif if (pScrn->vtSema) { + if (pCursorInfo) + pCursorInfo->HideCursor(pScrn); SISRestore(pScrn); vgaHWLock(hwp); SISUnmapMem(pScrn); } if(pSiS->AccelInfoPtr) - XAADestroyInfoRec(pSiS->AccelInfoPtr); + XAADestroyInfoRec(pSiS->AccelInfoPtr); if(pCursorInfo) - xf86DestroyCursorInfoRec(pCursorInfo); + xf86DestroyCursorInfoRec(pCursorInfo); pScrn->vtSema = FALSE; pScreen->CloseScreen = pSiS->CloseScreen; @@ -1524,7 +1672,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode) return vgaHWSaveScreen(pScreen, mode); } -#ifdef DEBUG +#ifdef DEBUG /* local used for debug */ static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode) @@ -1566,27 +1714,86 @@ static void SISModifyModeInfo(DisplayModePtr mode) { /* - mode->Clock = 31500; - mode->CrtcHTotal = 832; - mode->CrtcHDisplay = 640; - mode->CrtcHBlankStart = 648; - mode->CrtcHSyncStart = 664; - mode->CrtcHSyncEnd = 704; - mode->CrtcHBlankEnd = 824; - - mode->CrtcVTotal = 520; - mode->CrtcVDisplay = 480; - mode->CrtcVBlankStart = 488; - mode->CrtcVSyncStart = 489; - mode->CrtcVSyncEnd = 492; - mode->CrtcVBlankEnd = 512; + mode->Clock = 31500; + mode->CrtcHTotal = 832; + mode->CrtcHDisplay = 640; + mode->CrtcHBlankStart = 648; + mode->CrtcHSyncStart = 664; + mode->CrtcHSyncEnd = 704; + mode->CrtcHBlankEnd = 824; + + mode->CrtcVTotal = 520; + mode->CrtcVDisplay = 480; + mode->CrtcVBlankStart = 488; + mode->CrtcVSyncStart = 489; + mode->CrtcVSyncEnd = 492; + mode->CrtcVBlankEnd = 512; */ - if (mode->CrtcHBlankStart == mode->CrtcHDisplay) - mode->CrtcHBlankStart++; - if (mode->CrtcHBlankEnd == mode->CrtcHTotal) - mode->CrtcHBlankEnd--; - if (mode->CrtcVBlankStart == mode->CrtcVDisplay) - mode->CrtcVBlankStart++; - if (mode->CrtcVBlankEnd == mode->CrtcVTotal) - mode->CrtcVBlankEnd--; + if (mode->CrtcHBlankStart == mode->CrtcHDisplay) + mode->CrtcHBlankStart++; + if (mode->CrtcHBlankEnd == mode->CrtcHTotal) + mode->CrtcHBlankEnd--; + if (mode->CrtcVBlankStart == mode->CrtcVDisplay) + mode->CrtcVBlankStart++; + if (mode->CrtcVBlankEnd == mode->CrtcVTotal) + mode->CrtcVBlankEnd--; +} + +void SiSPreSetMode(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char ulDispType; + unsigned char ulTemp; + unsigned char usTVType; + unsigned char usScratchCR30, usScratchCR31, usScratchCR32; + unsigned short SR26, SR27; + unsigned long temp; + + ulDispType = 0; /* Default connect CRT */ + ulTemp = GetReg1(SISCR, 0x32); + if( ulTemp & 0x10 ) + ulDispType = MASK_DISPTYPE_CRT2; + if( ulTemp & 0x08 ) + ulDispType = MASK_DISPTYPE_LCD; + if( ulTemp & 0x07 ) + ulDispType = MASK_DISPTYPE_TV; + + switch(ulDispType & MASK_DISPTYPE_DISP2) + { + case MASK_DISPTYPE_CRT2: + usScratchCR30 = 0x41; + usScratchCR31 = 0x40; + break; + case MASK_DISPTYPE_LCD: + usScratchCR30 = 0x21; + usScratchCR31 = 0x40; + break; + case MASK_DISPTYPE_TV: + usScratchCR32 = GetReg1(SISCR, 0x32) & 0x07; + usScratchCR32 <<= 2; + usScratchCR30 = 0x01 | usScratchCR32; + usTVType = GetReg1(SISSR, 0x38) & 0x01; + if(usTVType) /* PAL */ + usScratchCR31 = 0x41; + else /* NTSC */ + usScratchCR31 = 0x40; + break; + default: + /* disable CRT2 */ + usScratchCR30 = 0x00; + usScratchCR31 = 0x60; + } + SetReg1(SISCR, 0x30, usScratchCR30); + SetReg1(SISCR, 0x31, usScratchCR31); + + /* Set Turbo Queue as 512K */ + if (!pSiS->NoAccel) { + if (pSiS->TurboQueue) { + temp = (pScrn->videoRam/64) - 8; + SR26 = temp & 0xFF; + SR27 = ((temp >> 8) & 3) | 0xF0; + SetReg1(SISSR, 0x26, SR26); + SetReg1(SISSR, 0x27, SR27); + } + } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c index a44b39477..01a92422f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.2 2000/02/12 23:08:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.3 2000/08/01 20:52:25 dawes Exp $ */ #include "xf86.h" @@ -79,10 +79,11 @@ SiSOptions(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Fast VRAM enabled\n"); } - if (xf86ReturnOptValBool(SISOptions, OPTION_TURBOQUEUE, FALSE)) { +/* if (xf86ReturnOptValBool(SISOptions, OPTION_TURBOQUEUE, FALSE)) { pSiS->TurboQueue = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling TurboQueue\n"); - } + } */ + pSiS->TurboQueue = TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c new file mode 100644 index 000000000..78ec6efb0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c @@ -0,0 +1,80 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.1 2000/08/01 20:52:26 dawes Exp $ */ + +#include "xf86.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" + +#include "sis.h" +#include "sis_regs.h" +#include "sis_vb.h" + +void SISLCDPreInit(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int temp; + + + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); + if (!(temp & 0x20)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x08) + pSiS->VBFlags |= CRT2_LCD; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); + if (temp == 1) + pSiS->VBFlags = CRT2_LCD | LCD_800x600; + if (temp == 2) + pSiS->VBFlags = CRT2_LCD | LCD_1024x768; + if (temp == 3) + pSiS->VBFlags = CRT2_LCD | LCD_1280x1024; +} + +void SISTVPreInit(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int temp; + + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); + if (!(temp & 0x20)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x07) + pSiS->VBFlags |= CRT2_TV; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); + if (temp & 0x10) + pSiS->VBFlags = CRT2_TV | TV_SCART; + else if (temp & 0x08) + pSiS->VBFlags = CRT2_TV | TV_SVIDEO; + else if (temp & 0x04) + pSiS->VBFlags = CRT2_TV | TV_AVIDEO; + else + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); + if (temp & 0x01) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; +} + +void SISCRT2PreInit(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + int temp; + + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, temp); + if (!(temp & 0x20)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x10) + pSiS->VBFlags |= CRT2_VGA; + + return; + +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h new file mode 100644 index 000000000..f767c45fd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h @@ -0,0 +1,37 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ + +/* CR30 VBInfo = CR31:CR30 */ +#define SET_SIMU_SCAN_MODE 0x0001 +#define SWITCH_TO_CRT2 0x0002 +#define SET_CRT2_TO_AVIDEO 0x0004 /* Composite */ +#define SET_CRT2_TO_SVIDEO 0x0008 +#define SET_CRT2_TO_SCART 0x0010 +#define SET_CRT2_TO_LCD 0x0020 +#define SET_CRT2_TO_RAMDAC 0x0040 +#define SET_CRT2_TO_HIVISION_TV 0x0080 +#define SET_CRT2_TO_TV (SET_CRT2_TO_AVIDEO | SET_CRT2_TO_SVIDEO | \ + SET_CRT2_TO_SCART | SET_CRT2_TO_HIVISION_TV) +/* CR31 */ +#define SET_PAL_TV 0x0100 +#define SET_IN_SLAVE_MODE 0x0200 +#define SET_NO_SIMU_ON_LOCK 0x0400 +#define SET_NO_SIMU_TV_ON_LOCK SET_NO_SIMU_ON_LOCK +#define DISABLE_LOAD_CRT2DAC 0x1000 +#define DISABLE_CRT2_DISPLAY 0x2000 +#define DRIVER_MODE 0x4000 + +Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr); + +extern void EnableBridge(unsigned short); +extern void DisableBridge(unsigned short); +extern void LockCRT2(unsigned short); +extern void UnLockCRT2(unsigned short); + +typedef struct _SiS301Reg { + CARD8 *VBPart1; + CARD8 *VBPart2; + CARD8 *VBPart3; + CARD8 *VBPart4; +} SiS301RegRec, SiS301RegPtr; + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c index 00307edab..27b06b5ec 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.3 2000/03/31 20:13:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.4 2000/08/01 20:52:26 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -38,7 +38,7 @@ #include "sis.h" #include "sis_regs.h" -#include "sis_bios.h" +#include "sis_vb.h" #define Midx 0 @@ -404,7 +404,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) int num, denum, div, sbit, scale; unsigned short Threshold_Low, Threshold_High; - + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SIS300Init()\n"); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "virtualX = %d depth = %d Logical width = %d\n", @@ -414,7 +414,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - (*pSiS->SiSSave)(pScrn, pReg); + (*pSiS->SiSSave)(pScrn, pReg); outw(VGA_SEQ_INDEX, 0x8605); @@ -441,12 +441,12 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) pSiS->DstColor = (short) 0xC000; pReg->sisRegs3C4[6] |= ((4 << 2) | 0x03); break; - } + } pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); pReg->sisRegs3D4[0x19] = 0; - pReg->sisRegs3D4[0x1A] &= 0xFC; + pReg->sisRegs3D4[0x1A] &= 0xFC; if (mode->Flags & V_INTERLACE) { offset = pSiS->scrnOffset >> 2; @@ -460,16 +460,16 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) } else { offset = pSiS->scrnOffset >> 3; pReg->sisRegs3C4[0x06] &= ~0x20; - } + } - pReg->sisRegs3C4[0x07] |= 0x10; /* enable High Speed DAC */ + pReg->sisRegs3C4[0x07] |= 0x10; /* enable High Speed DAC */ pReg->sisRegs3C4[0x07] &= 0xFC; if (clock < 100000) pReg->sisRegs3C4[0x07] |= 0x03; else if (clock < 200000) pReg->sisRegs3C4[0x07] |= 0x02; else if (clock < 250000) - pReg->sisRegs3C4[0x07] |= 0x01; + pReg->sisRegs3C4[0x07] |= 0x01; /* Extended Vertical Overflow */ pReg->sisRegs3C4[0x0A] = @@ -478,7 +478,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) GETBITSTR(mode->CrtcVBlankStart , 10:10, 2:2) | GETBITSTR(mode->CrtcVSyncStart , 10:10, 3:3) | GETBITSTR(mode->CrtcVBlankEnd , 8:8, 4:4) | - GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; + GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; /* Extended Horizontal Overflow */ pReg->sisRegs3C4[0x0B] = @@ -490,12 +490,12 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[0x0C] &= 0xF8; pReg->sisRegs3C4[0x0C] |= GETBITSTR(mode->CrtcHBlankEnd >> 3, 7:6, 1:0) | - GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; + GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; /* Screen Offset */ vgaReg->CRTC[0x13] = GETVAR8(offset); pReg->sisRegs3C4[0x0E] &= 0xF0; - pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); + pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); /* line compare */ if (mode->CrtcHDisplay > 0) @@ -507,7 +507,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; /* Enable Linear */ - pReg->sisRegs3C4[0x20] |= 0x81; + pReg->sisRegs3C4[0x20] |= 0x81; /* Set vclk */ @@ -521,7 +521,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[0x2C] |= 0x80; pReg->sisRegs3C4[0x2D] = 0x80; } - else { + else { /* if compute_vclk cannot handle the request clock try sisCalcClock! */ SiSCalcClock(pScrn, clock, 2, vclk); pReg->sisRegs3C4[0x2B] = (vclk[Midx] - 1) & 0x7f ; @@ -530,11 +530,11 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) /* bits [4:0] contain denumerator -MC */ pReg->sisRegs3C4[0x2C] = (vclk[Nidx] -1) & 0x1f ; - if (vclk[Pidx] <= 4) { + if (vclk[Pidx] <= 4) { /* postscale 1,2,3,4 */ pReg->sisRegs3C4[0x2C] |= (vclk[Pidx] -1 ) << 5 ; pReg->sisRegs3C4[0x2C] &= 0x7F; - } else { + } else { /* postscale 6,8 */ pReg->sisRegs3C4[0x2C] |= ((vclk[Pidx] / 2) -1 ) << 5 ; pReg->sisRegs3C4[0x2C] |= 0x80; @@ -548,27 +548,26 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) } else { pReg->sisRegs3C4[0x07] &= 0x7F; pReg->sisRegs3C4[0x32] &= 0xF7; - } - + } pReg->sisRegs3C2 = inb(0x3CC) | 0x0C; /* Programmable Clock */ if (!pSiS->NoAccel) { pReg->sisRegs3C4[0x1E] |= 0x42; - if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ + if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ temp = ((pScrn->videoRam/64)-4); pReg->sisRegs3C4[0x26] = temp & 0xFF; pReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) || 0xF0; } - } + } /* set threshold value */ (*pSiS->SetThreshold)(pScrn, mode, &Threshold_Low, &Threshold_High); - pReg->sisRegs3C4[0x08] = GETBITSTR(Threshold_Low, 3:0, 7:4) | 0xF; + pReg->sisRegs3C4[0x08] = GETBITSTR(Threshold_Low, 3:0, 7:4) | 0xF; pReg->sisRegs3C4[0x0F] &= ~GENMASK(5:5); pReg->sisRegs3C4[0x0F] |= GETBITSTR(Threshold_Low, 4:4, 5:5); pReg->sisRegs3C4[0x09] &= ~GENMASK(3:0); - pReg->sisRegs3C4[0x09] |= GETBITS(Threshold_High, 3:0); + pReg->sisRegs3C4[0x09] |= GETBITS(Threshold_High, 3:0); return(TRUE); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h index 6e36726c8..d05ee5790 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h,v 1.9 1999/12/13 23:48:22 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_regs.h,v 1.10 2000/07/26 01:52:22 tsi Exp $ */ /* TGA hardware description (minimal) * @@ -34,6 +34,7 @@ #ifndef TGA_REGS_H #define TGA_REGS_H +#include "xf86_ansic.h" #include "compiler.h" #define TYPE_TGA_8PLANE 0 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile index 2dc280363..769b68cf0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.23 2000/03/03 01:05:44 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.24 2000/07/05 13:41:37 alanh Exp $ XCOMM XCOMM This is an Imakefile for the TRIDENT driver. XCOMM @@ -18,7 +18,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mi -I$(XF86SRC)/xaa -I$(SERVERSRC)/fb \ - -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb \ + -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/shadowfb \ + -I$(XF86SRC)/xf4bpp -I$(SERVERSRC)/mfb \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c index f4764d211..e4cc22d85 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.6 1999/10/14 17:20:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.7 2000/07/05 13:41:37 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -306,8 +306,8 @@ BladeSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, } #endif + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -367,8 +367,8 @@ BladeSetupForSolidLine(ScrnInfoPtr pScrn, int color, BLADE_OUT(0x2160, color); BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -464,8 +464,8 @@ BladeSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, BLADE_OUT(0x2164, bg); BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -502,8 +502,8 @@ BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, BLADE_OUT(0x2160, color); BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -536,8 +536,8 @@ BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, IMAGE_OUT(0x48, bg); IMAGE_OUT(0x20, 0x90000000 | XAACopyROP[rop]); pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -578,8 +578,8 @@ BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, BLADE_OUT(0x2160, fg); BLADE_OUT(0x2164, bg); } + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -656,8 +656,8 @@ BladeSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, BLADE_OUT(0x2178, bg); } pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -697,8 +697,8 @@ BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, pTrident->BltScanDirection |= 1<<6; } TGUI_FMIX(XAAPatternROP[rop]); + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } @@ -729,8 +729,8 @@ static void BladeSetupForImageWrite( BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; + REPLICATE(planemask); if (planemask != -1) { - REPLICATE(planemask); BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h index 6d9b3dc33..db9da51c8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.24 2000/06/13 02:28:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.25 2000/08/04 16:13:34 eich Exp $ */ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -100,10 +100,14 @@ typedef struct { int MinClock; int MaxClock; int MUXThreshold; + int currentClock; int MCLK; int dwords; int height; int lcdMode; +#ifdef READOUT + Bool DontSetClock; +#endif TRIDENTRegRec SavedReg; TRIDENTRegRec ModeReg; I2CBusPtr DDC; @@ -137,8 +141,11 @@ typedef struct { int shadow_10; int shadow_11; int shadow_16; + int shadow_HiOrd; } tridentLCD; +extern tridentLCD LCD[]; + typedef struct { int x_res; int y_res; @@ -163,6 +170,7 @@ Bool TridentAccelInit(ScreenPtr pScreen); Bool ImageAccelInit(ScreenPtr pScreen); Bool BladeAccelInit(ScreenPtr pScreen); Bool TridentHWCursorInit(ScreenPtr pScreen); +int TridentFindMode(int xres, int yres, int depth); void TGUISetClock(ScrnInfoPtr pScrn, int clock, unsigned char *a, unsigned char *b); void TGUISetMCLK(ScrnInfoPtr pScrn, int clock, unsigned char *a, unsigned char *b); void TridentOutIndReg(ScrnInfoPtr pScrn, @@ -180,7 +188,7 @@ int TGUISetReadWrite(ScreenPtr pScreen, int bank); int TVGA8900SetRead(ScreenPtr pScreen, int bank); int TVGA8900SetWrite(ScreenPtr pScreen, int bank); int TVGA8900SetReadWrite(ScreenPtr pScreen, int bank); - +void TridentFindClock(ScrnInfoPtr pScrn, int clock); float CalculateMCLK(ScrnInfoPtr pScrn); /* diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c index 7e7a919b4..1b98224c5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c @@ -23,7 +23,7 @@ * * Trident accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.10 2000/01/27 01:13:23 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.11 2000/07/05 13:41:37 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -302,13 +302,13 @@ TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, if (xdir < 0) pTrident->BltScanDirection |= XNEG; if (ydir < 0) pTrident->BltScanDirection |= YNEG; + REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685) { dst |= 1<<16; } else { TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); } - REPLICATE(transparency_color); TGUI_CKEY(transparency_color); } @@ -588,13 +588,13 @@ TridentWritePixmap( if (w & 7) w += 8 - (w & 7); + REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685) { dst |= 1<<16; } else { TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); } - REPLICATE(transparency_color); TGUI_CKEY(transparency_color); } TGUI_SRC_XY(0,0); @@ -702,13 +702,13 @@ TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, pTrident->Chipset == TGUI9680) && rop == GXcopy) drawflag |= FASTMODE; + REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685) { drawflag |= 1<<16; } else { TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); } - REPLICATE(transparency_color); TGUI_CKEY(transparency_color); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c index 251574a01..2a6f492bb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.23 2000/06/23 18:25:58 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.25 2000/08/04 16:13:34 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -35,8 +35,6 @@ #include "trident.h" #include "trident_regs.h" -extern tridentLCD LCD[]; - biosMode bios1[] = { { 640, 480, 0x11 } }; @@ -54,9 +52,10 @@ biosMode bios4[] = { biosMode bios8[] = { { 320, 200, 0x13 }, - { 640, 400, 0x52 }, + { 640, 400, 0x5c }, { 640, 480, 0x5d }, { 720, 480, 0x60 }, + { 800, 600, 0x5e }, { 1024, 768, 0x62 }, { 1280, 1024, 0x64 }, { 1600, 1200, 0x66 } @@ -67,7 +66,9 @@ biosMode bios15[] = { { 640, 480, 0x74 }, { 720, 480, 0x70 }, { 800, 600, 0x76 }, - { 1024, 768, 0x78 } + { 1024, 768, 0x78 }, + { 1280, 1024, 0x7a }, + { 1600, 1200, 0x7c } }; biosMode bios16[] = { @@ -75,7 +76,9 @@ biosMode bios16[] = { { 640, 480, 0x75 }, { 720, 480, 0x71 }, { 800, 600, 0x77 }, - { 1024, 768, 0x79 } + { 1024, 768, 0x79 }, + { 1280, 1024, 0x7b }, + { 1600, 1200, 0x7d } }; biosMode bios24[] = { @@ -87,8 +90,8 @@ biosMode bios24[] = { }; -static int -findMode(int xres, int yres, int depth) +int +TridentFindMode(int xres, int yres, int depth) { int xres_s; int i, size; @@ -145,7 +148,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) TRIDENTRegPtr pReg = &pTrident->ModeReg; int vgaIOBase; int offset = 0; - int clock = mode->Clock; + int clock = pTrident->currentClock; CARD8 protect; vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -153,7 +156,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - /* Unprotect */ OUTB(0x3C4, 0x11); protect = INB(0x3C4); @@ -168,59 +170,22 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3CE[MiscExtFunc] = INB(0x3CF) & 0xF0; pReg->tridentRegs3x4[GraphEngReg] = 0x00; - /* Enable Chipset specific options */ - switch (pTrident->Chipset) { - case CYBERBLADEI7: - case CYBERBLADEI7D: - case CYBERBLADEI1: - case CYBERBLADEI1D: - case BLADE3D: - OUTB(vgaIOBase + 4, RAMDACTiming); - pReg->tridentRegs3x4[RAMDACTiming] |= 0x0F; - pReg->tridentRegs3x4[GraphEngReg] |= 0x10; - /* Fall Through */ - case CYBER9520: - case CYBER9525DVD: - case CYBER9540: - case CYBER9397DVD: - case CYBER9397: - case CYBER9388: - case IMAGE975: - case IMAGE985: - if (pScrn->bitsPerPixel >= 8) - pReg->tridentRegs3CE[MiscExtFunc] |= 0x10; - /* Fall Through */ - case PROVIDIA9685: - if (pTrident->UsePCIRetry) { - pTrident->UseGERetry = TRUE; - pReg->tridentRegs3x4[Enhancement0] = 0x50; - } else { - pTrident->UseGERetry = FALSE; - pReg->tridentRegs3x4[Enhancement0] = 0x00; - } - /* Fall Through */ - case PROVIDIA9682: - if (pTrident->UsePCIRetry) - pReg->tridentRegs3x4[PCIRetry] = 0xDF; - else - pReg->tridentRegs3x4[PCIRetry] = 0x00; - /* Fall Through */ - case TGUI9660: - case TGUI9680: - if (pTrident->MUX && pScrn->bitsPerPixel == 8 && mode->CrtcHAdjusted) { - pReg->tridentRegs3x4[PixelBusReg] |= 0x01; /* 16bit bus */ - pReg->tridentRegs3C4[NewMode2] |= 0x02; /* half clock */ - pReg->tridentRegsDAC[0x00] |= 0x20; /* mux mode */ - } - } + pReg->tridentRegs3x4[CRTHiOrd] = (((mode->CrtcVBlankEnd-1) & 0x400)>>4) | + (((mode->CrtcVTotal - 2) & 0x400) >> 3) | + ((mode->CrtcVSyncStart & 0x400) >> 5) | + (((mode->CrtcVDisplay - 1) & 0x400) >> 6)| + 0x08; if (pTrident->IsCyber) { Bool LCDActive; +#ifdef READOUT Bool ShadowModeActive; - int i; - +#endif + int i = pTrident->lcdMode; +#ifdef READOUT OUTB(0x3CE, CyberControl); ShadowModeActive = ((INB(0x3CF) & 0x81) == 0x81); +#endif OUTB(0x3CE, FPConfig); LCDActive = (INB(0x3CF) & 0x10); @@ -243,6 +208,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) OUTB(0x3CE,VertStretch); pReg->tridentRegs3CE[VertStretch] = INB(0x3CF); +#ifdef READOUT if ((!((pReg->tridentRegs3CE[VertStretch] & 1) || (pReg->tridentRegs3CE[HorStretch] & 1))) && (!LCDActive || ShadowModeActive)) { @@ -256,44 +222,46 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) OUTB(vgaIOBase + 4,4); pReg->tridentRegs3x4[0x4] = INB(vgaIOBase + 5); OUTB(vgaIOBase + 4,5); - pReg->tridentRegs3x4[0x5] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4,0x6); - pReg->tridentRegs3x4[0x6] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4,0x7); - pReg->tridentRegs3x4[0x7] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4,0x10); - pReg->tridentRegs3x4[0x10] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4,0x11); - pReg->tridentRegs3x4[0x11] = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 4,0x16); - pReg->tridentRegs3x4[0x16] = INB(vgaIOBase + 5); - SHADOW_RESTORE(tmp); - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Timing shadow registers:" - "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " - "0x%2.2x 0x%2.2x 0x%2.2x\n",pReg->tridentRegs3x4[0], - pReg->tridentRegs3x4[3], pReg->tridentRegs3x4[4], - pReg->tridentRegs3x4[5], pReg->tridentRegs3x4[6], - pReg->tridentRegs3x4[7], pReg->tridentRegs3x4[0x10], - pReg->tridentRegs3x4[0x11], - pReg->tridentRegs3x4[0x16]); - } else { - if ((i = pTrident->lcdMode)) { - pReg->tridentRegs3x4[0x0] = LCD[i].shadow_0; - pReg->tridentRegs3x4[0x3] = LCD[i].shadow_3; - pReg->tridentRegs3x4[0x4] = LCD[i].shadow_4; - pReg->tridentRegs3x4[0x5] = LCD[i].shadow_5; - pReg->tridentRegs3x4[0x6] = LCD[i].shadow_6; - pReg->tridentRegs3x4[0x7] = LCD[i].shadow_7; - pReg->tridentRegs3x4[0x10] = LCD[i].shadow_10; - pReg->tridentRegs3x4[0x11] = LCD[i].shadow_11; - pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16; - /* Not yet implemented */ - clock = LCD[i].clock; - } - } - /* copy over common bits from normal VGA */ - - pReg->tridentRegs3x4[0x7] &= ~0x52; + pReg->tridentRegs3x4[0x5] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4,0x6); + pReg->tridentRegs3x4[0x6] = INB(vgaIOBase + 5); + SHADOW_RESTORE(tmp); + } else +#endif + { + if (i != 0xff) { + pReg->tridentRegs3x4[0x0] = LCD[i].shadow_0; + pReg->tridentRegs3x4[0x3] = LCD[i].shadow_3; + pReg->tridentRegs3x4[0x4] = LCD[i].shadow_4; + pReg->tridentRegs3x4[0x5] = LCD[i].shadow_5; + pReg->tridentRegs3x4[0x6] = LCD[i].shadow_6; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1, + "Overriding Horizontal timings."); + } + } + + if (i != 0xff) { + pReg->tridentRegs3x4[0x7] = LCD[i].shadow_7; + pReg->tridentRegs3x4[0x10] = LCD[i].shadow_10; + pReg->tridentRegs3x4[0x11] = LCD[i].shadow_11; + pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16; + if (LCDActive) + pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd; + } + + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Timing shadow registers:" + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", + pReg->tridentRegs3x4[0], pReg->tridentRegs3x4[3], + pReg->tridentRegs3x4[4], pReg->tridentRegs3x4[5], + pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7], + pReg->tridentRegs3x4[0x10],pReg->tridentRegs3x4[0x11], + pReg->tridentRegs3x4[0x16], + pReg->tridentRegs3x4[CRTHiOrd]); + + /* copy over common bits from normal VGA */ + + pReg->tridentRegs3x4[0x7] &= ~0x52; pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x52); /* disable stretching, enable centering */ @@ -321,26 +289,71 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3x4[PreEndFetch] = INB(vgaIOBase + 5); #endif /* set mode */ - pReg->tridentRegs3CE[BiosMode] = findMode(pScrn->currentMode->HDisplay, - pScrn->currentMode->VDisplay, - pScrn->depth); + pReg->tridentRegs3CE[BiosMode] = TridentFindMode( + pScrn->currentMode->HDisplay, + pScrn->currentMode->VDisplay, + pScrn->depth); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, "Setting BIOS Mode: %x\n", pReg->tridentRegs3CE[BiosMode]); /* no stretch */ pReg->tridentRegs3CE[BiosReg] = 0; -#if 0 - /* obsolete */ - if (pTrident->CyberShadowSet) { - if (pTrident->CyberShadow) { - pReg->tridentRegs3CE[CyberControl] |= 0x81; - } else - pReg->tridentRegs3CE[CyberControl] &= 0x7E; + if (LCDActive) { + pReg->tridentRegs3CE[CyberControl] |= 0x81; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n"); + } else { + pReg->tridentRegs3CE[CyberControl] &= 0x7E; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n"); } -#endif + } + /* Enable Chipset specific options */ + switch (pTrident->Chipset) { + case CYBERBLADEI7: + case CYBERBLADEI7D: + case CYBERBLADEI1: + case CYBERBLADEI1D: + case BLADE3D: + OUTB(vgaIOBase + 4, RAMDACTiming); + pReg->tridentRegs3x4[RAMDACTiming] |= 0x0F; + pReg->tridentRegs3x4[GraphEngReg] |= 0x10; + /* Fall Through */ + case CYBER9520: + case CYBER9525DVD: + case CYBER9540: + case CYBER9397DVD: + case CYBER9397: + case CYBER9388: + case IMAGE975: + case IMAGE985: + if (pScrn->bitsPerPixel >= 8) + pReg->tridentRegs3CE[MiscExtFunc] |= 0x10; + /* Fall Through */ + case PROVIDIA9685: + if (pTrident->UsePCIRetry) { + pTrident->UseGERetry = TRUE; + pReg->tridentRegs3x4[Enhancement0] = 0x50; + } else { + pTrident->UseGERetry = FALSE; + pReg->tridentRegs3x4[Enhancement0] = 0x00; + } + /* Fall Through */ + case PROVIDIA9682: + if (pTrident->UsePCIRetry) + pReg->tridentRegs3x4[PCIRetry] = 0xDF; + else + pReg->tridentRegs3x4[PCIRetry] = 0x00; + /* Fall Through */ + case TGUI9660: + case TGUI9680: + if (pTrident->MUX && pScrn->bitsPerPixel == 8 && mode->CrtcHAdjusted) { + pReg->tridentRegs3x4[PixelBusReg] |= 0x01; /* 16bit bus */ + pReg->tridentRegs3C4[NewMode2] |= 0x02; /* half clock */ + pReg->tridentRegsDAC[0x00] |= 0x20; /* mux mode */ + } } + /* Defaults for all trident chipsets follows */ switch (pScrn->bitsPerPixel) { case 1: @@ -386,7 +399,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { CARD8 a, b; - TGUISetClock(pScrn, clock, &a, &b); pReg->tridentRegsClock[0x00] = (INB(0x3CC) & 0xF3) | 0x08; pReg->tridentRegsClock[0x01] = a; @@ -410,12 +422,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3x4[LinearAddReg] = 0; } - pReg->tridentRegs3x4[CRTHiOrd] = (((mode->CrtcVBlankEnd-1) & 0x400)>>4) | - (((mode->CrtcVTotal - 2) & 0x400) >> 3) | - ((mode->CrtcVSyncStart & 0x400) >> 5) | - (((mode->CrtcVDisplay - 1) & 0x400) >> 6) | - 0x08; - pReg->tridentRegs3x4[CRTCModuleTest] = (mode->Flags & V_INTERLACE ? 0x84 : 0x80); OUTB(vgaIOBase+ 4, InterfaceSel); @@ -446,6 +452,10 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) OUTB(0x3CE, MiscIntContReg); pReg->tridentRegs3CE[MiscIntContReg] = INB(0x3CF) | 0x04; + /* Fix hashing problem in > 8bpp on 9320 chipset */ + if (pTrident->Chipset == CYBER9320 && pScrn->bitsPerPixel > 8) + pReg->tridentRegs3CE[MiscIntContReg] &= ~0x80; + OUTB(vgaIOBase+ 4, PCIReg); if (IsPciCard && UseMMIO) pReg->tridentRegs3x4[PCIReg] = INB(vgaIOBase + 5) & 0xF9; @@ -535,22 +545,37 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) } if (Is3Dchip) { - OUTW(0x3C4, (tridentReg->tridentRegsClock[0x01])<<8 | ClockLow); - OUTW(0x3C4, (tridentReg->tridentRegsClock[0x02])<<8 | ClockHigh); +#ifdef READOUT + if (!pTrident->DontSetClock) +#endif + { + OUTW(0x3C4, (tridentReg->tridentRegsClock[0x01])<<8 | ClockLow); + OUTW(0x3C4, (tridentReg->tridentRegsClock[0x02])<<8 | ClockHigh); + } if (pTrident->MCLK > 0) { OUTW(0x3C4,(tridentReg->tridentRegsClock[0x03])<<8 | MCLKLow); OUTW(0x3C4,(tridentReg->tridentRegsClock[0x04])<<8 | MCLKHigh); } } else { - OUTB(0x43C8, tridentReg->tridentRegsClock[0x01]); - OUTB(0x43C9, tridentReg->tridentRegsClock[0x02]); +#ifdef READOUT + if (!pTrident->DontSetClock) +#endif + { + OUTB(0x43C8, tridentReg->tridentRegsClock[0x01]); + OUTB(0x43C9, tridentReg->tridentRegsClock[0x02]); + } if (pTrident->MCLK > 0) { OUTB(0x43C6, tridentReg->tridentRegsClock[0x03]); OUTB(0x43C7, tridentReg->tridentRegsClock[0x04]); } } - OUTB(0x3C2, tridentReg->tridentRegsClock[0x00]); - +#ifdef READOUT + if (!pTrident->DontSetClock) +#endif + { + OUTB(0x3C2, tridentReg->tridentRegsClock[0x00]); + } + OUTB(0x3C4, Protection); OUTB(0x3C5, tridentReg->tridentRegs3C4[Protection]); OUTW(0x3C4, ((tridentReg->tridentRegs3C4[NewMode1] ^ 0x02) << 8)| NewMode1); @@ -811,7 +836,6 @@ void TridentSetOverscan( ScrnInfoPtr pScrn, int overscan ){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); if (overscan < 0 || overscan > 255) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c index 4c1c23537..70ca94fc5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c @@ -28,10 +28,10 @@ * Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the * clockchip programming code. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.100 2000/06/21 17:28:16 dawes Exp $ */ - -#include "cfb24_32.h" +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.104 2000/08/04 21:07:19 tsi Exp $ */ +#include "xf1bpp.h" +#include "xf4bpp.h" #include "fb.h" #include "mibank.h" @@ -286,6 +286,9 @@ static int ClockLimit[] = { 135000, 170000, 170000, + 170000, + 230000, + 230000, 230000, 230000, 230000, @@ -321,6 +324,9 @@ static int ClockLimit16bpp[] = { 135000, 170000, 170000, + 170000, + 230000, + 230000, 230000, 230000, 230000, @@ -356,6 +362,9 @@ static int ClockLimit24bpp[] = { 70000, 85000, 85000, + 85000, + 115000, + 115000, 115000, 115000, 115000, @@ -392,6 +401,10 @@ static int ClockLimit32bpp[] = { 85000, 85000, 115000, + 85000, + 115000, + 115000, + 115000, 115000, 115000, 115000, @@ -405,17 +418,27 @@ static int ClockLimit32bpp[] = { * These are fixed modelines for all physical display dimensions the * chipsets supports on FPs. Most of them are not tested yet. */ +#if 0 tridentLCD LCD[] = { - { 0,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb}, - { 1,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72}, - { 2,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96}, - { 3,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96}, - { 4,"1280x1024",108000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96}, - { 5,"1024x600",50500 ,0xa3,0x6,0x8f,0xa0,0xb,0x3e,0xea,0x8c,0xb}, + { 0,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08}, + { 1,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, + { 2,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08}, + { 3,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08}, + { 4,"1280x1024",108000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08}, + { 5,"1024x600",50500 ,0xa3,0x6,0x8f,0xa0,0xb,0x3e,0xea,0x8c,0xb,0x08}, { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; +#else +tridentLCD LCD[] = { + { 1,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08}, + { 3,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, + { 2,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x96,0x08}, + { 0,"1280x1024",108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8}, + { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; +#endif - static const char *xaaSymbols[] = { +static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAACreateInfoRec", "XAAHelpPatternROP", @@ -445,7 +468,8 @@ static const char *vgahwSymbols[] = { static const char *fbSymbols[] = { "fbScreenInit", - "cfb24_32ScreenInit", + "xf1bppScreenInit", + "xf4bppScreenInit", NULL }; @@ -1731,10 +1755,20 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) unsigned char tmp; pTrident->lcdMode = 0xff; +#if 0 OUTB(0x3CE,0x41); +#else + OUTB(0x3CE,0x52); +#endif tmp = INB(0x3CF); for (i = 0; LCD[i].mode != 0xff; i++) { - if (LCD[i].mode == (tmp & 0x7)) { + if (LCD[i].mode == ( +#if 0 + tmp & 0x7 +#else + (tmp >> 4) & 3 +#endif + )) { pTrident->lcdMode = i; xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %s found\n", (tmp & 0x8) ? "DSTN" : "TFT", LCD[i].display); @@ -1896,7 +1930,15 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { case 1: + pTrident->EngineOperation |= 0x00; + mod = "xf1bpp"; + Sym = "xf1bppScreenInit"; + break; case 4: + pTrident->EngineOperation |= 0x00; + mod = "xf4bpp"; + Sym = "xf4bppScreenInit"; + break; case 8: pTrident->EngineOperation |= 0x00; mod = "fb"; @@ -1909,13 +1951,8 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) break; case 24: pTrident->EngineOperation |= 0x03; - if (pix24bpp == 24) { - mod = "fb"; - Sym = "fbScreenInit"; - } else { - mod = "xf24_32bpp"; - Sym = "cfb24_32ScreenInit"; - } + mod = "fb"; + Sym = "fbScreenInit"; break; case 32: pTrident->EngineOperation |= 0x02; @@ -2123,9 +2160,11 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaRegPtr vgaReg; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTRegPtr tridentReg; + int clock; + + TridentFindClock(pScrn,mode->Clock); - if (mode->Clock > pTrident->MUXThreshold) pTrident->MUX = TRUE; - else pTrident->MUX = FALSE; + clock = pTrident->currentClock; switch (pTrident->Chipset) { case TGUI9660: @@ -2200,6 +2239,18 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) return TRUE; } +#if 0 +Bool +TridentCyberBIOSModeInit(ScrnInfoPtr pScrn) +{ + int mode = TridentFindMode(pScrn->currentMode->HDisplay, + pScrn->currentMode->VDisplay, + pScrn->depth); + TridentUnstretch(); + +} +#endif + /* * Restore the initial (text) mode. */ @@ -2337,24 +2388,23 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) switch (pScrn->bitsPerPixel) { case 1: + ret = xf1bppScreenInit(pScreen, FBStart, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 4: + ret = xf4bppScreenInit(pScreen, FBStart, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; case 8: case 16: + case 24: case 32: ret = fbScreenInit(pScreen, FBStart, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); break; - case 24: - if (pix24bpp == 24) - ret = fbScreenInit(pScreen, FBStart, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel); - else - ret = cfb24_32ScreenInit(pScreen, FBStart, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; default: xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in TRIDENTScrnInit\n", diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h index e0d5bb863..8de17c25b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.12 2000/06/06 18:07:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.13 2000/08/04 16:13:35 eich Exp $ */ #define DEBUG 1 @@ -98,7 +98,7 @@ #define MiscIntContReg 0x2F #define CyberControl 0x30 #define CyberEnhance 0x31 -#define FPConfig 0x34 +#define FPConfig 0x33 #define VertStretch 0x52 #define HorStretch 0x53 #define BiosMode 0x5c diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c index 77a90e8bb..d52dc5cad 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.11 1999/10/13 20:02:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.12 2000/08/04 16:13:35 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -111,6 +111,59 @@ IsClearTV(ScrnInfoPtr pScrn) pTrident->frequency = NTSC; } +void +TridentFindClock(ScrnInfoPtr pScrn, int clock) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + pTrident->MUX = FALSE; +#ifdef READOUT + pTrident->DontSetClock = FALSE; +#endif + pTrident->currentClock = clock; + + if (pTrident->IsCyber) { +#ifdef READOUT + Bool LCDActive; + Bool ShadowModeActive; + Bool HStretch; + Bool VStretch; + + OUTB(0x3CE, FPConfig); + LCDActive = (INB(0x3CF) & 0x10); + OUTB(0x3CE,HorStretch); + HStretch = (INB(0x3CF) & 0x01); + OUTB(0x3CE,VertStretch); + VStretch = (INB(0x3CF) & 0x01); + + if (!(VStretch || HStretch) && LCDActive) { + CARD8 temp; + temp = INB(0x3C8); + temp = INB(0x3C6); + temp = INB(0x3C6); + temp = INB(0x3C6); + temp = INB(0x3C6); + pTrident->MUX = ((INB(0x3C6) & 0x20) == 0x20); + temp = INB(0x3C8); + pTrident->DontSetClock = TRUE; + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Keeping Clock for LCD Mode\n"); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"MUX is %s\n",pTrident->MUX? + "on":"off"); + return; + + } else +#endif + { + if (pTrident->lcdMode != 0xff) + pTrident->currentClock = clock = LCD[pTrident->lcdMode].clock; + } + + } + if (clock > pTrident->MUXThreshold) pTrident->MUX = TRUE; + else pTrident->MUX = FALSE; + +} + float CalculateMCLK(ScrnInfoPtr pScrn) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile index 237b5dbd8..c9a30a305 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/10 1996/09/28 17:29:32 rws $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile,v 1.16 2000/03/03 01:05:44 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile,v 1.17 2000/08/08 08:58:06 eich Exp $ #define IHaveModules #include <Server.tmpl> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/README b/xc/programs/Xserver/hw/xfree86/drivers/tseng/README index ab3e57d47..dca1c6b39 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/README +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/README @@ -261,4 +261,4 @@ the off-screen scanline buffers and calling the Subsequent() function. -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/README,v 1.11 1998/07/25 16:55:59 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/README,v 1.12 2000/08/08 08:58:06 eich Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp index 5d0cbfe5b..4b15e24ad 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp,v 1.4 2000/06/14 02:13:15 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp,v 1.5 2000/08/08 08:58:06 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH TSENG __drivermansuffix__ "Version 4.0.1" "XFree86" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h index 2d8ea0082..ae9fe96ae 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.27 1999/06/12 07:18:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.30 2000/08/08 08:58:06 eich Exp $ */ @@ -8,9 +8,6 @@ #ifndef _TSENG_H #define _TSENG_H -/* Everything using inb/outb, etc needs "compiler.h" */ -#include "compiler.h" - /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" @@ -18,6 +15,9 @@ /* All drivers need this */ #include "xf86_ansic.h" +/* Everything using inb/outb, etc needs "compiler.h" */ +#include "compiler.h" + /* This is used for module versioning */ #include "xf86Version.h" @@ -240,6 +240,16 @@ typedef struct { unsigned char * XAAScanlineColorExpandBuffers[1]; CARD32* ColExpLUT; EntityInfoPtr pEnt; + memType MMioBase; + memType scratchMemBase; + memType tsengCPU2ACLBase; + /* These will hold the ping-pong registers. */ + int tsengFg; + int tsengBg; + int tsengPat; + int tseng_old_dir; + int old_x; + int old_y; } TsengRec, *TsengPtr; #define TsengPTR(p) ((TsengPtr)((p)->driverPrivate)) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c index fe9b534c2..22dd8a8ff 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c @@ -1,9 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c,v 1.30 1999/09/25 14:37:31 dawes Exp $ */ - - - - - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c,v 1.32 2000/08/08 08:58:06 eich Exp $ */ /* * ET4/6K acceleration interface. @@ -100,7 +95,6 @@ TsengXAAInit(ScreenPtr pScreen) TsengPtr pTseng = TsengPTR(pScrn); XAAInfoRecPtr pXAAinfo; BoxRec AvailFBArea; - int i; PDEBUG(" TsengXAAInit\n"); pTseng->AccelInfoRec = pXAAinfo = XAACreateInfoRec(); @@ -253,7 +247,7 @@ TsengXAAInit(ScreenPtr pScreen) } #endif -#if 1 +#if 0 /*1*/ /* * SolidLine. * @@ -369,12 +363,14 @@ TsengXAAInit(ScreenPtr pScreen) * Init ping-pong registers. * This might be obsoleted by the BACKGROUND_OPERATIONS flag. */ - tsengMemFg = MemW32ForegroundPing; - tsengFg = W32ForegroundPing; - tsengMemBg = MemW32BackgroundPing; - tsengBg = W32BackgroundPing; - tsengMemPat = MemW32PatternPing; - tsengPat = W32PatternPing; + pTseng->tsengFg = 0; + pTseng->tsengBg = 16; + pTseng->tsengPat = 32; + + /* for register write optimisation */ + pTseng->tseng_old_dir = -1; + pTseng->old_x = 0; + pTseng->old_y = 0; /* * Finally, we set up the video memory space available to the pixmap @@ -431,7 +427,7 @@ TsengSetupForSolidFill(ScrnInfoPtr pScrn, /* ErrorF("S"); */ - PINGPONG(); + PINGPONG(pTseng); wait_acl_queue(pTseng); @@ -482,7 +478,7 @@ TsengW32pSubsequentSolidFillRect(ScrnInfoPtr pScrn, * here without calling the SetupFor... code again, and the * ACL_SOURCE_ADDRESS will be wrong. */ - *ACL_SOURCE_ADDRESS = tsengFg; + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengFg); SET_XYDIR(0); /* FIXME: not needed with separate setupforsolidline */ @@ -515,7 +511,7 @@ Tseng6KSubsequentSolidFillRect(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); /* see comment in TsengW32pSubsequentFillRectSolid */ - *ACL_SOURCE_ADDRESS = tsengFg; + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengFg); /* if XYDIR is not reset here, drawing a hardware line in between * blitting, with the same ROP, color, etc will not cause a call to @@ -589,8 +585,8 @@ TsengSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, Tseng_setup_screencopy(pTseng, rop, planemask, trans_color, blit_dir); - *ACL_SOURCE_WRAP = 0x77; /* no wrap */ - *ACL_SOURCE_Y_OFFSET = pTseng->line_width - 1; + ACL_SOURCE_WRAP(0x77); /* no wrap */ + ACL_SOURCE_Y_OFFSET(pTseng->line_width - 1); } /* @@ -655,7 +651,7 @@ TsengSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); SET_XY(pTseng, w, h); - *ACL_SOURCE_ADDRESS = srcaddr; + ACL_SOURCE_ADDRESS(srcaddr); START_ACL(pTseng, destaddr); } @@ -675,20 +671,20 @@ TsengSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, switch (pTseng->Bytesperpixel) { case 1: - *ACL_SOURCE_WRAP = 0x33; /* 8x8 wrap */ - *ACL_SOURCE_Y_OFFSET = 8 - 1; + ACL_SOURCE_WRAP(0x33); /* 8x8 wrap */ + ACL_SOURCE_Y_OFFSET(8 - 1); break; case 2: - *ACL_SOURCE_WRAP = 0x34; /* 16x8 wrap */ - *ACL_SOURCE_Y_OFFSET = 16 - 1; + ACL_SOURCE_WRAP(0x34); /* 16x8 wrap */ + ACL_SOURCE_Y_OFFSET(16 - 1); break; case 3: - *ACL_SOURCE_WRAP = 0x3D; /* 24x8 wrap --- only for ET6000 !!! */ - *ACL_SOURCE_Y_OFFSET = 32 - 1; /* this is no error -- see databook */ + ACL_SOURCE_WRAP(0x3D); /* 24x8 wrap --- only for ET6000 !!! */ + ACL_SOURCE_Y_OFFSET(32 - 1); /* this is no error -- see databook */ break; case 4: - *ACL_SOURCE_WRAP = 0x35; /* 32x8 wrap */ - *ACL_SOURCE_Y_OFFSET = 32 - 1; + ACL_SOURCE_WRAP(0x35); /* 32x8 wrap */ + ACL_SOURCE_Y_OFFSET(32 - 1); } } @@ -702,7 +698,7 @@ TsengSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); - *ACL_SOURCE_ADDRESS = srcaddr; + ACL_SOURCE_ADDRESS(srcaddr); SET_XY(pTseng, w, h); START_ACL(pTseng, destaddr); @@ -722,8 +718,8 @@ TsengSetupForScanlineImageWrite(ScrnInfoPtr pScrn, Tseng_setup_screencopy(pTseng, rop, planemask, trans_color, 0); - *ACL_SOURCE_WRAP = 0x77; /* no wrap */ - *ACL_SOURCE_Y_OFFSET = pTseng->line_width - 1; + ACL_SOURCE_WRAP(0x77); /* no wrap */ + ACL_SOURCE_Y_OFFSET(pTseng->line_width - 1); } static CARD32 iw_dest, iw_skipleft; @@ -753,7 +749,7 @@ TsengSubsequentImageWriteScanline(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); - *ACL_SOURCE_ADDRESS = pTseng->AccelImageWriteBufferOffsets[bufno] + iw_skipleft; + ACL_SOURCE_ADDRESS(pTseng->AccelImageWriteBufferOffsets[bufno] + iw_skipleft); START_ACL(pTseng, iw_dest); iw_dest += pTseng->line_width; } @@ -800,18 +796,19 @@ TsengSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, if (!(octant & YMAJOR)) { SET_X_YRAW(pTseng, len, 0xFFF); } else { - SET_XY_RAW(0xFFF, len - 1); + SET_XY_RAW(pTseng,0xFFF, len - 1); } SET_DELTA(minor, major); - *ACL_ERROR_TERM = -err; /* error term from XAA is NEGATIVE */ + ACL_ERROR_TERM(-err); /* error term from XAA is NEGATIVE */ /* make sure colors are rendered correctly if >8bpp */ if (octant & XDECREASING) { destaddr += pTseng->Bytesperpixel - 1; - *ACL_SOURCE_ADDRESS = tsengFg + pTseng->neg_x_pixel_offset; + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + + pTseng->tsengFg + pTseng->neg_x_pixel_offset); } else - *ACL_SOURCE_ADDRESS = tsengFg; + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengFg); SET_XYDIR(xydir); @@ -900,7 +897,7 @@ TsengSubsequentFillTrapezoidSolid(ytop, height, left, dxL, dyL, eL, right, dxR, SetYMajorOctant(octant); SET_DELTA(dxL, dyL); } - *ACL_ERROR_TERM = eL; + ACL_ERROR_TERM(eL); /* select "linedraw algorithm" (=bias) and load direction register */ /* ErrorF(" o=%d ", octant); */ @@ -924,7 +921,7 @@ TsengSubsequentFillTrapezoidSolid(ytop, height, left, dxL, dyL, eL, right, dxR, } else { /* Y is major axis */ SET_SECONDARY_DELTA(dxR, dyR); } - *ACL_SECONDARY_ERROR_TERM = eR; + ACL_SECONDARY_ERROR_TERM(eR); /* ErrorF("%02x", sec_dir_reg); */ SET_SECONDARY_XYDIR(sec_dir_reg); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c index 0a7c9d7aa..ae63cb15e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c,v 1.21 1998/09/05 06:36:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.c,v 1.23 2000/08/08 08:58:06 eich Exp $ */ @@ -7,53 +7,10 @@ #include "tseng.h" #include "tseng_acl.h" +#include "compiler.h" void tseng_terminate_acl(TsengPtr pTseng); -ByteP W32Buffer; - -LongP MBP0, MBP1, MBP2; -ByteP MMU_CONTROL; - -ByteP ACL_SUSPEND_TERMINATE, ACL_OPERATION_STATE, ACL_SYNC_ENABLE, ACL_WRITE_INTERFACE_VALID, - ACL_INTERRUPT_MASK, ACL_INTERRUPT_STATUS, ACL_ACCELERATOR_STATUS; - -WordP ACL_X_POSITION, ACL_Y_POSITION; - -WordP ACL_NQ_X_POSITION, ACL_NQ_Y_POSITION; - -LongP ACL_PATTERN_ADDRESS, ACL_SOURCE_ADDRESS; - -WordP ACL_PATTERN_Y_OFFSET, ACL_SOURCE_Y_OFFSET, ACL_DESTINATION_Y_OFFSET; - -ByteP ACL_VIRTUAL_BUS_SIZE, /* only for w32 and w32i */ - ACL_XY_DIRECTION, /* only for w32 and w32i */ - ACL_PIXEL_DEPTH; /* only for w32p_rev_A and w32p_rev_B */ - -ByteP ACL_PATTERN_WRAP, ACL_SOURCE_WRAP; - -WordP ACL_X_COUNT, ACL_Y_COUNT; -LongP ACL_XY_COUNT; /* for combined writes to X and Y count registers */ - -ByteP ACL_ROUTING_CONTROL, ACL_RELOAD_CONTROL, ACL_BACKGROUND_RASTER_OPERATION, - ACL_FOREGROUND_RASTER_OPERATION; - -LongP ACL_DESTINATION_ADDRESS, /* only for w32p_rev_A and w32p_rev_B */ - ACL_MIX_ADDRESS; - -WordP ACL_MIX_Y_OFFSET, ACL_ERROR_TERM, ACL_DELTA_MINOR, ACL_DELTA_MAJOR; - -/* for ET6000 only */ -ByteP ACL_POWER_CONTROL; - -ByteP ACL_SECONDARY_EDGE; -WordP ACL_SECONDARY_ERROR_TERM, ACL_SECONDARY_DELTA_MINOR, ACL_SECONDARY_DELTA_MAJOR; -ByteP ACL_TRANSFER_DISABLE; - -ByteP W32BytePtr; -WordP W32WordPtr; -LongP W32LongPtr; - /* * conversion from X ROPs to Microsoft ROPs. */ @@ -118,39 +75,7 @@ int W32PatternOpTable[] = 0xff /* Xset 1 */ }; -long W32ForegroundPing; -long W32ForegroundPong; -long W32BackgroundPing; -long W32BackgroundPong; -long W32PatternPing; -long W32PatternPong; - -LongP MemW32ForegroundPing; -LongP MemW32ForegroundPong; -LongP MemW32BackgroundPing; -LongP MemW32BackgroundPong; -LongP MemW32PatternPing; -LongP MemW32PatternPong; - -unsigned char * tsengCPU2ACLBase; -/* used for optimisation of direction-register writing */ -int tseng_old_dir = -1; -int old_x = 0, old_y = 0; - -/* These will hold the ping-pong registers. - * Note that ping-pong registers might not be needed when using - * BACKGROUND_OPERATIONS (because of the WAIT()-ing involved) - */ - -LongP tsengMemFg; -long tsengFg; - -LongP tsengMemBg; -long tsengBg; - -LongP tsengMemPat; -long tsengPat; /**********************************************************************/ @@ -160,15 +85,15 @@ tseng_terminate_acl(TsengPtr pTseng) /* only terminate when needed */ /* if (*(volatile unsigned char *)ACL_ACCELERATOR_STATUS & 0x06) */ { - *ACL_SUSPEND_TERMINATE = 0x00; + ACL_SUSPEND_TERMINATE(0x00); /* suspend any running operation */ - *ACL_SUSPEND_TERMINATE = 0x01; + ACL_SUSPEND_TERMINATE(0x01); WAIT_ACL; - *ACL_SUSPEND_TERMINATE = 0x00; + ACL_SUSPEND_TERMINATE(0x00); /* ... and now terminate it */ - *ACL_SUSPEND_TERMINATE = 0x10; + ACL_SUSPEND_TERMINATE(0x10); WAIT_ACL; - *ACL_SUSPEND_TERMINATE = 0x00; + ACL_SUSPEND_TERMINATE(0x00); } } @@ -177,23 +102,20 @@ tseng_recover_timeout(TsengPtr pTseng) { if (!Is_ET6K) { ErrorF("trying to unlock......................................\n"); - *tsengCPU2ACLBase = 0L; /* try unlocking the bus when CPU-to-accel gets stuck */ + MMIO_OUT32(pTseng->tsengCPU2ACLBase,0,0L); /* try unlocking the bus when CPU-to-accel gets stuck */ } if (Is_W32p) { /* flush the accelerator pipeline */ - *ACL_SUSPEND_TERMINATE = 0x00; - *ACL_SUSPEND_TERMINATE = 0x02; - *ACL_SUSPEND_TERMINATE = 0x00; + ACL_SUSPEND_TERMINATE(0x00); + ACL_SUSPEND_TERMINATE(0x02); + ACL_SUSPEND_TERMINATE(0x00); } } -long MMioBase; - void tseng_init_acl(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TsengPtr pTseng = TsengPTR(pScrn); - long scratchMemBase; PDEBUG(" tseng_init_acl\n"); /* @@ -201,17 +123,15 @@ tseng_init_acl(ScreenPtr pScreen) */ if (pTseng->UseLinMem) { - MMioBase = (long)pTseng->FbBase + 0x3FFF00; - scratchMemBase = (long)pTseng->FbBase + pTseng->AccelColorBufferOffset; + pTseng->scratchMemBase = (long)pTseng->FbBase + pTseng->AccelColorBufferOffset; /* * we won't be using tsengCPU2ACLBase in linear memory mode anyway, since * using the MMU apertures restricts the amount of useable video memory * to only 2MB, supposing we ONLY redirect MMU aperture 2 to the CPU. * (see data book W32p, page 207) */ - tsengCPU2ACLBase = (unsigned char*) ((long)pTseng->FbBase + 0x200000); /* MMU aperture 2 */ + pTseng->tsengCPU2ACLBase = (memType)((long)pTseng->FbBase + 0x200000); /* MMU aperture 2 */ } else { - MMioBase = (long)pTseng->FbBase + 0x1FF00L; /* * MMU 0 is used for the scratchpad (i.e. FG and BG colors). * @@ -220,107 +140,18 @@ tseng_init_acl(ScreenPtr pScreen) * being the first, and don't exceed 8kb (aperture size) in total * length. */ - scratchMemBase = (long)pTseng->FbBase + 0x18000L; - *((LongP) (MMioBase + 0x00)) = pTseng->AccelColorBufferOffset; - *((LongP) (MMioBase + 0x04)) = pTseng->AccelImageWriteBufferOffsets[0]; + pTseng->scratchMemBase = (long)pTseng->FbBase + 0x18000L; + MMIO_IN32(pTseng->MMioBase, 0x00<<0) = pTseng->AccelColorBufferOffset; + MMIO_IN32(pTseng->MMioBase, 0x04<<0) = pTseng->AccelImageWriteBufferOffsets[0]; /* * tsengCPU2ACLBase is used for CPUtoSCreen...() operations on < ET6000 devices */ - tsengCPU2ACLBase = (unsigned char*) ((long)pTseng->FbBase + 0x1C000L); /* MMU aperture 2 */ - /* *((LongP) (MMioBase + 0x08)) = 200000; *//* TEST */ + pTseng->tsengCPU2ACLBase = (memType) ((long)pTseng->FbBase + 0x1C000L); /* MMU aperture 2 */ + /* MMIO_IN32(pTseng->MMioBase, 0x08<<0) = 200000; *//* TEST */ } - - /* ErrorF("MMioBase = 0x%x, scratchMemBase = 0x%x\n", MMioBase, scratchMemBase); */ - - MMU_CONTROL = (ByteP) (MMioBase + 0x13); - - ACL_SUSPEND_TERMINATE = (ByteP) (MMioBase + 0x30); - ACL_OPERATION_STATE = (ByteP) (MMioBase + 0x31); - - ACL_SYNC_ENABLE = (ByteP) (MMioBase + 0x32); - /* for ET6000, ACL_SYNC_ENABLE becomes ACL_6K_CONFIG */ - - ACL_WRITE_INTERFACE_VALID = (ByteP) (MMioBase + 0x33); - ACL_INTERRUPT_MASK = (ByteP) (MMioBase + 0x34); - ACL_INTERRUPT_STATUS = (ByteP) (MMioBase + 0x35); - ACL_ACCELERATOR_STATUS = (ByteP) (MMioBase + 0x36); - - /* and this is only for the ET6000 */ - ACL_POWER_CONTROL = (ByteP) (MMioBase + 0x37); - - /* non-queued for w32p's and ET6000 */ - ACL_NQ_X_POSITION = (WordP) (MMioBase + 0x38); - ACL_NQ_Y_POSITION = (WordP) (MMioBase + 0x3A); - /* queued for w32 and w32i */ - ACL_X_POSITION = (WordP) (MMioBase + 0x94); - ACL_Y_POSITION = (WordP) (MMioBase + 0x96); - - ACL_PATTERN_ADDRESS = (LongP) (MMioBase + 0x80); - ACL_SOURCE_ADDRESS = (LongP) (MMioBase + 0x84); - - ACL_PATTERN_Y_OFFSET = (WordP) (MMioBase + 0x88); - ACL_SOURCE_Y_OFFSET = (WordP) (MMioBase + 0x8A); - ACL_DESTINATION_Y_OFFSET = (WordP) (MMioBase + 0x8C); - - /* W32i */ - ACL_VIRTUAL_BUS_SIZE = (ByteP) (MMioBase + 0x8E); - /* w32p */ - ACL_PIXEL_DEPTH = (ByteP) (MMioBase + 0x8E); - - /* w32 and w32i */ - ACL_XY_DIRECTION = (ByteP) (MMioBase + 0x8F); - - ACL_PATTERN_WRAP = (ByteP) (MMioBase + 0x90); - ACL_TRANSFER_DISABLE = (ByteP) (MMioBase + 0x91); /* ET6000 only */ - ACL_SOURCE_WRAP = (ByteP) (MMioBase + 0x92); - - ACL_X_COUNT = (WordP) (MMioBase + 0x98); - ACL_Y_COUNT = (WordP) (MMioBase + 0x9A); - ACL_XY_COUNT = (LongP) (ACL_X_COUNT); /* shortcut. not a real register */ - - ACL_ROUTING_CONTROL = (ByteP) (MMioBase + 0x9C); - /* for ET6000, ACL_ROUTING_CONTROL becomes ACL_MIX_CONTROL */ - ACL_RELOAD_CONTROL = (ByteP) (MMioBase + 0x9D); - /* for ET6000, ACL_RELOAD_CONTROL becomes ACL_STEPPING_INHIBIT */ - - ACL_BACKGROUND_RASTER_OPERATION = (ByteP) (MMioBase + 0x9E); - ACL_FOREGROUND_RASTER_OPERATION = (ByteP) (MMioBase + 0x9F); - - ACL_DESTINATION_ADDRESS = (LongP) (MMioBase + 0xA0); - - /* the following is for the w32p's only */ - ACL_MIX_ADDRESS = (LongP) (MMioBase + 0xA4); - - ACL_MIX_Y_OFFSET = (WordP) (MMioBase + 0xA8); - ACL_ERROR_TERM = (WordP) (MMioBase + 0xAA); - ACL_DELTA_MINOR = (WordP) (MMioBase + 0xAC); - ACL_DELTA_MAJOR = (WordP) (MMioBase + 0xAE); - - /* ET6000 only (trapezoids) */ - ACL_SECONDARY_EDGE = (ByteP) (MMioBase + 0x93); - ACL_SECONDARY_ERROR_TERM = (WordP) (MMioBase + 0xB2); - ACL_SECONDARY_DELTA_MINOR = (WordP) (MMioBase + 0xB4); - ACL_SECONDARY_DELTA_MAJOR = (WordP) (MMioBase + 0xB6); - - /* addresses in video memory (i.e. "0" = first byte in video memory) */ - W32ForegroundPing = pTseng->AccelColorBufferOffset + 0; - W32ForegroundPong = pTseng->AccelColorBufferOffset + 8; - - W32BackgroundPing = pTseng->AccelColorBufferOffset + 16; - W32BackgroundPong = pTseng->AccelColorBufferOffset + 24; - - W32PatternPing = pTseng->AccelColorBufferOffset + 32; - W32PatternPong = pTseng->AccelColorBufferOffset + 40; - - /* addresses in the memory map */ - MemW32ForegroundPing = (LongP) (scratchMemBase + 0); - MemW32ForegroundPong = (LongP) (scratchMemBase + 8); - - MemW32BackgroundPing = (LongP) (scratchMemBase + 16); - MemW32BackgroundPong = (LongP) (scratchMemBase + 24); - - MemW32PatternPing = (LongP) (scratchMemBase + 32); - MemW32PatternPong = (LongP) (scratchMemBase + 40); +#ifdef DEBUG + ErrorF("MMioBase = 0x%x, scratchMemBase = 0x%x\n", pTseng->MMioBase, pTseng->scratchMemBase); +#endif /* * prepare the accelerator for some real work @@ -328,35 +159,35 @@ tseng_init_acl(ScreenPtr pScreen) tseng_terminate_acl(pTseng); - *ACL_INTERRUPT_STATUS = 0xe; /* clear interrupts */ - *ACL_INTERRUPT_MASK = 0x04; /* disable interrupts, but enable deadlock exit */ - *ACL_INTERRUPT_STATUS = 0x0; - *ACL_ACCELERATOR_STATUS = 0x0; + ACL_INTERRUPT_STATUS(0xe); /* clear interrupts */ + ACL_INTERRUPT_MASK(0x04); /* disable interrupts, but enable deadlock exit */ + ACL_INTERRUPT_STATUS(0x0); + ACL_ACCELERATOR_STATUS_SET(0x0); if (Is_ET6K) { - *ACL_STEPPING_INHIBIT = 0x0; /* Undefined at power-on, let all maps (Src, Dst, Mix, Pat) step */ - *ACL_6K_CONFIG = 0x00; /* maximum performance -- what did you think? */ - *ACL_POWER_CONTROL = 0x01; /* conserve power when ACL is idle */ - *ACL_MIX_CONTROL = 0x33; - *ACL_TRANSFER_DISABLE = 0x00; /* Undefined at power-on, enable all transfers */ + ACL_STEPPING_INHIBIT(0x0); /* Undefined at power-on, let all maps (Src, Dst, Mix, Pat) step */ + ACL_6K_CONFIG(0x00); /* maximum performance -- what did you think? */ + ACL_POWER_CONTROL(0x01); /* conserve power when ACL is idle */ + ACL_MIX_CONTROL(0x33); + ACL_TRANSFER_DISABLE(0x00); /* Undefined at power-on, enable all transfers */ } else { /* W32i/W32p */ - *ACL_RELOAD_CONTROL = 0x0; - *ACL_SYNC_ENABLE = 0x1; /* | 0x2 = 0WS ACL read. Yields up to 10% faster operation for small blits */ - *ACL_ROUTING_CONTROL = 0x00; + ACL_RELOAD_CONTROL(0x0); + ACL_SYNC_ENABLE(0x1); /* | 0x2 = 0WS ACL read. Yields up to 10% faster operation for small blits */ + ACL_ROUTING_CONTROL(0x00); } if (Is_W32p || Is_ET6K) { /* Enable the W32p startup bit and set use an eight-bit pixel depth */ - *ACL_NQ_X_POSITION = 0; - *ACL_NQ_Y_POSITION = 0; - *ACL_PIXEL_DEPTH = (pScrn->bitsPerPixel - 8) << 1; + ACL_NQ_X_POSITION(0); + ACL_NQ_Y_POSITION(0); + ACL_PIXEL_DEPTH((pScrn->bitsPerPixel - 8) << 1); /* writing destination address will start ACL */ - *ACL_OPERATION_STATE = 0x10; + ACL_OPERATION_STATE(0x10); } else { /* X, Y positions set to zero's for w32 and w32i */ - *ACL_X_POSITION = 0; - *ACL_Y_POSITION = 0; - *ACL_OPERATION_STATE = 0x0; + ACL_X_POSITION(0); + ACL_Y_POSITION(0); + ACL_OPERATION_STATE(0x0); /* if we ever use CPU-to-screen pixmap uploading on W32I or W32, * ACL_VIRTUAL_BUS_SIZE will need to be made dynamic (i.e. moved to * Setup() functions). @@ -364,12 +195,12 @@ tseng_init_acl(ScreenPtr pScreen) * VBS = 1 byte is faster than VBS = 4 bytes, since the ACL can * start processing as soon as the first byte arrives. */ - *ACL_VIRTUAL_BUS_SIZE = 0x00; + ACL_VIRTUAL_BUS_SIZE(0x00); } - *ACL_DESTINATION_Y_OFFSET = pScrn->displayWidth * pTseng->Bytesperpixel - 1; - *ACL_XY_DIRECTION = 0; + ACL_DESTINATION_Y_OFFSET(pScrn->displayWidth * pTseng->Bytesperpixel - 1); + ACL_XY_DIRECTION(0); - *MMU_CONTROL = 0x74; + MMU_CONTROL(0x74); if (Is_W32p && pTseng->UseLinMem) { /* @@ -392,11 +223,11 @@ tseng_init_acl(ScreenPtr pScreen) * linear memory when the accelerator is enabled. */ if (Is_W32p_ab) { - *((LongP) (MMioBase + 0x00)) = 0x200000L; - *((LongP) (MMioBase + 0x04)) = 0x280000L; + MMIO_OUT32(pTseng->MMioBase, 0x00<<0, 0x200000L); + MMIO_OUT32(pTseng->MMioBase, 0x04<<0, 0x280000L); } else { /* rev C & D */ - *((LongP) (MMioBase + 0x00)) = 0x0L; - *((LongP) (MMioBase + 0x04)) = 0x100000L; + MMIO_OUT32(pTseng->MMioBase, 0x00<<0, 0x0L); + MMIO_OUT32 (pTseng->MMioBase, 0x04<<0, 0x100000L); } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h index 5986b5776..02c577110 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h @@ -1,8 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h,v 1.17 1998/09/05 06:36:55 dawes Exp $ */ - - - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_acl.h,v 1.19 2000/08/08 08:58:06 eich Exp $ */ #ifndef _TSENG_ACL_H @@ -28,64 +25,93 @@ void tseng_recover_timeout(TsengPtr pTseng); * Shortcuts to Tseng memory-mapped accelerator-control registers */ -extern -ByteP MMU_CONTROL; +#if 0 +#endif -extern -ByteP ACL_SUSPEND_TERMINATE, ACL_OPERATION_STATE, ACL_SYNC_ENABLE, ACL_WRITE_INTERFACE_VALID, - ACL_INTERRUPT_MASK, ACL_INTERRUPT_STATUS, ACL_ACCELERATOR_STATUS; +#define MMU_CONTROL(x) MMIO_OUT8(pTseng->MMioBase, 0x13<<0, x) +#define ACL_SUSPEND_TERMINATE(x) MMIO_OUT8(pTseng->MMioBase, 0x30<<0, x) +#define ACL_OPERATION_STATE(x) MMIO_OUT8(pTseng->MMioBase, 0x31<<0, x) + +#define ACL_SYNC_ENABLE(x) MMIO_OUT8(pTseng->MMioBase, 0x32<<0, x) + /* for ET6000, ACL_SYNC_ENABLE becomes ACL_6K_CONFIG */ + +#define ACL_INTERRUPT_STATUS(x) \ + MMIO_OUT8(pTseng->MMioBase, 0x35<<0, x) +#define ACL_INTERRUPT_MASK(x) MMIO_OUT8(pTseng->MMioBase, 0x34<<0, x) +#define ACL_ACCELERATOR_STATUS (0x36 << 0) +#define ACL_ACCELERATOR_STATUS_SET(x) \ + MMIO_OUT8(pTseng->MMioBase, ACL_ACCELERATOR_STATUS, x) +#define ACL_WRITE_INTERFACE_VALID (0x33 << 0) + + /* and this is only for the ET6000 */ +#define ACL_POWER_CONTROL(x) MMIO_OUT8(pTseng->MMioBase, 0x37<<0, x) + + /* non-queued for w32p's and ET6000 */ +#define ACL_NQ_X_POSITION(x) MMIO_OUT16(pTseng->MMioBase, 0x38<<0, x) +#define ACL_NQ_Y_POSITION(x) MMIO_OUT16(pTseng->MMioBase, 0x3A<<0, x) + /* queued for w32 and w32i */ +#define ACL_X_POSITION(x) MMIO_OUT16(pTseng->MMioBase, 0x94<<0, x) +#define ACL_Y_POSITION(x) MMIO_OUT16(pTseng->MMioBase, 0x96<<0, x) + +#define ACL_PATTERN_ADDRESS(x) MMIO_OUT32(pTseng->MMioBase, 0x80<<0, x) +#define ACL_SOURCE_ADDRESS(x) MMIO_OUT32(pTseng->MMioBase, 0x84<<0, x) + +#define ACL_PATTERN_Y_OFFSET(x) MMIO_OUT16(pTseng->MMioBase, 0x88<<0, x) +#define ACL_PATTERN_Y_OFFSET32(x) MMIO_OUT32(pTseng->MMioBase, 0x88<<0, x) +#define ACL_SOURCE_Y_OFFSET(x) MMIO_OUT16(pTseng->MMioBase, 0x8A<<0, x) +#define ACL_DESTINATION_Y_OFFSET(x) MMIO_OUT16(pTseng->MMioBase, 0x8C<<0, x) + + /* W32i */ +#define ACL_VIRTUAL_BUS_SIZE(x) MMIO_OUT8(pTseng->MMioBase, 0x8E<<0, x) + /* w32p */ +#define ACL_PIXEL_DEPTH(x) MMIO_OUT8(pTseng->MMioBase, 0x8E<<0, x) + + /* w32 and w32i */ +#define ACL_XY_DIRECTION(x) MMIO_OUT8(pTseng->MMioBase, 0x8F<<0, x) + +#define ACL_PATTERN_WRAP(x) MMIO_OUT8(pTseng->MMioBase, 0x90<<0, x) +#define ACL_PATTERN_WRAP32(x) MMIO_OUT32(pTseng->MMioBase, 0x90<<0, x) +#define ACL_TRANSFER_DISABLE(x) MMIO_OUT8(pTseng->MMioBase, 0x91<<0, x) /* ET6000 only */ +#define ACL_SOURCE_WRAP(x) MMIO_OUT8(pTseng->MMioBase, 0x92<<0, x) + +#define ACL_X_COUNT(x) MMIO_OUT16(pTseng->MMioBase, 0x98<<0, x) +#define ACL_Y_COUNT(x) MMIO_OUT16(pTseng->MMioBase, 0x9A<<0, x) +/* shortcut. not a real register */ +#define ACL_XY_COUNT(x) MMIO_OUT32(pTseng->MMioBase, 0x98<<0, x) + +#define ACL_ROUTING_CONTROL(x) MMIO_OUT8(pTseng->MMioBase, 0x9C<<0, x) + /* for ET6000, ACL_ROUTING_CONTROL becomes ACL_MIX_CONTROL */ +#define ACL_RELOAD_CONTROL(x) MMIO_OUT8(pTseng->MMioBase, 0x9D<<0, x) + /* for ET6000, ACL_RELOAD_CONTROL becomes ACL_STEPPING_INHIBIT */ + +#define ACL_BACKGROUND_RASTER_OPERATION(x) MMIO_OUT8(pTseng->MMioBase, 0x9E<<0, x) +#define ACL_FOREGROUND_RASTER_OPERATION(x) MMIO_OUT8(pTseng->MMioBase, 0x9F<<0, x) + +#define ACL_DESTINATION_ADDRESS(x) MMIO_OUT32(pTseng->MMioBase, 0xA0<<0, x) + + /* the following is for the w32p's only */ +#define ACL_MIX_ADDRESS(x) MMIO_OUT32(pTseng->MMioBase, 0xA4<<0, x) + +#define ACL_MIX_Y_OFFSET(x) MMIO_OUT16(pTseng->MMioBase, 0xA8<<0, x) +#define ACL_ERROR_TERM(x) MMIO_OUT16(pTseng->MMioBase, 0xAA<<0, x) +#define ACL_DELTA_MINOR(x) MMIO_OUT16(pTseng->MMioBase, 0xAC<<0, x) +#define ACL_DELTA_MINOR32(x) MMIO_OUT32(pTseng->MMioBase, 0xAC<<0, x) +#define ACL_DELTA_MAJOR(x) MMIO_OUT16(pTseng->MMioBase, 0xAE<<0, x) + + /* ET6000 only (trapezoids) */ +#define ACL_SECONDARY_EDGE(x) MMIO_OUT8(pTseng->MMioBase, 0x93<<0, x) +#define ACL_SECONDARY_ERROR_TERM(x) MMIO_OUT16(pTseng->MMioBase, 0xB2<<0, x) +#define ACL_SECONDARY_DELTA_MINOR(x) MMIO_OUT16(pTseng->MMioBase, 0xB4<<0, x) +#define ACL_SECONDARY_DELTA_MINOR32(x) MMIO_OUT32(pTseng->MMioBase, 0xB4<<0, x) +#define ACL_SECONDARY_DELTA_MAJOR(x) MMIO_OUT16(pTseng->MMioBase, 0xB6<<0, x) /* for ET6000: */ #define ACL_6K_CONFIG ACL_SYNC_ENABLE -extern -WordP ACL_X_POSITION, ACL_Y_POSITION; - -extern -WordP ACL_NQ_X_POSITION, ACL_NQ_Y_POSITION; - -extern -LongP ACL_PATTERN_ADDRESS, ACL_SOURCE_ADDRESS; - -extern -WordP ACL_PATTERN_Y_OFFSET, ACL_SOURCE_Y_OFFSET, ACL_DESTINATION_Y_OFFSET; - -extern -ByteP ACL_VIRTUAL_BUS_SIZE, /* only for w32 and w32i */ - ACL_XY_DIRECTION, ACL_PIXEL_DEPTH; /* only for w32p_rev_A and w32p_rev_B */ - -extern -ByteP ACL_PATTERN_WRAP, ACL_SOURCE_WRAP; - -extern -WordP ACL_X_COUNT, ACL_Y_COUNT; -extern -LongP ACL_XY_COUNT; /* for combined writes to X and Y count registers */ - -extern -ByteP ACL_ROUTING_CONTROL, ACL_RELOAD_CONTROL, ACL_BACKGROUND_RASTER_OPERATION, - ACL_FOREGROUND_RASTER_OPERATION; - /* for ET6000: */ #define ACL_MIX_CONTROL ACL_ROUTING_CONTROL #define ACL_STEPPING_INHIBIT ACL_RELOAD_CONTROL -extern -LongP ACL_DESTINATION_ADDRESS, /* only for w32p_rev_A and w32p_rev_B */ - ACL_MIX_ADDRESS; - -extern -WordP ACL_MIX_Y_OFFSET, ACL_ERROR_TERM, ACL_DELTA_MINOR, ACL_DELTA_MAJOR; - -/* for ET6000 only */ -extern -ByteP ACL_POWER_CONTROL; -extern -ByteP ACL_SECONDARY_EDGE; -extern -WordP ACL_SECONDARY_ERROR_TERM, ACL_SECONDARY_DELTA_MINOR, ACL_SECONDARY_DELTA_MAJOR; -extern -ByteP ACL_TRANSFER_DISABLE; /* * Some data structures for faster accelerator programming. @@ -96,43 +122,6 @@ extern int W32OpTable_planemask[16]; extern int W32PatternOpTable[16]; /* - * The ping-pong registers. Probably too much hassle for too little gain. "TODO". - */ - -extern long W32ForegroundPing; -extern long W32ForegroundPong; -extern long W32BackgroundPing; -extern long W32BackgroundPong; -extern long W32PatternPing; -extern long W32PatternPong; - -extern LongP MemW32ForegroundPing; -extern LongP MemW32ForegroundPong; -extern LongP MemW32BackgroundPing; -extern LongP MemW32BackgroundPong; -extern LongP MemW32PatternPing; -extern LongP MemW32PatternPong; - -extern unsigned char * tsengCPU2ACLBase; - -/* - * These will hold the ping-pong registers. - */ - -extern LongP tsengMemFg; -extern long tsengFg; - -extern LongP tsengMemBg; -extern long tsengBg; - -extern LongP tsengMemPat; -extern long tsengPat; - -/* for register write optimisation */ -extern int old_x, old_y; -extern int tseng_old_dir; - -/* * Some shortcuts. */ @@ -140,11 +129,11 @@ extern int tseng_old_dir; #undef WAIT_VERBOSE /* if defined: print out how long we waited */ static __inline__ void -tseng_wait(TsengPtr pTseng, ByteP reg, char *name, unsigned char mask) +tseng_wait(TsengPtr pTseng, int reg, char *name, unsigned char mask) { int cnt = MAX_WAIT_CNT; - while (*reg & mask) + while ((MMIO_IN32(pTseng->MMioBase,reg)) & mask) if (--cnt < 0) { ErrorF("WAIT_%s: timeout.\n", name); tseng_recover_timeout(pTseng); @@ -166,39 +155,39 @@ tseng_wait(TsengPtr pTseng, ByteP reg, char *name, unsigned char mask) #define SET_FUNCTION_BLT \ if (Is_ET6K) \ - *ACL_MIX_CONTROL = 0x33; \ + ACL_MIX_CONTROL(0x33); \ else \ - *ACL_ROUTING_CONTROL = 0x00; + ACL_ROUTING_CONTROL(0x00); #define SET_FUNCTION_BLT_TR \ - *ACL_MIX_CONTROL = 0x13; + ACL_MIX_CONTROL(0x13); #define FBADDR(pTseng, x,y) ( (y) * pTseng->line_width + MULBPP(pTseng, x) ) #define SET_FG_ROP(rop) \ - *ACL_FOREGROUND_RASTER_OPERATION = W32OpTable[rop]; + ACL_FOREGROUND_RASTER_OPERATION(W32OpTable[rop]); #define SET_FG_ROP_PLANEMASK(rop) \ - *ACL_FOREGROUND_RASTER_OPERATION = W32OpTable_planemask[rop]; + ACL_FOREGROUND_RASTER_OPERATION(W32OpTable_planemask[rop]); #define SET_BG_ROP(rop) \ - *ACL_BACKGROUND_RASTER_OPERATION = W32PatternOpTable[rop]; + ACL_BACKGROUND_RASTER_OPERATION(W32PatternOpTable[rop]); #define SET_BG_ROP_TR(rop, bg_color) \ if ((bg_color) == -1) /* transparent color expansion */ \ - *ACL_BACKGROUND_RASTER_OPERATION = 0xaa; \ + ACL_BACKGROUND_RASTER_OPERATION(0xaa); \ else \ - *ACL_BACKGROUND_RASTER_OPERATION = W32PatternOpTable[rop]; + ACL_BACKGROUND_RASTER_OPERATION(W32PatternOpTable[rop]); #define SET_DELTA(Min, Maj) \ - *((LongP) ACL_DELTA_MINOR) = ((Maj) << 16) + (Min) + ACL_DELTA_MINOR32(((Maj) << 16) + (Min)) #define SET_SECONDARY_DELTA(Min, Maj) \ - *((LongP) ACL_SECONDARY_DELTA_MINOR) = ((Maj) << 16) + (Min) + ACL_SECONDARY_DELTA_MINOR(((Maj) << 16) + (Min)) #ifdef NO_OPTIMIZE #define SET_XYDIR(dir) \ - *ACL_XY_DIRECTION = (dir); + ACL_XY_DIRECTION(dir); #else /* * only changing ACL_XY_DIRECTION when it needs to be changed avoids @@ -206,29 +195,30 @@ tseng_wait(TsengPtr pTseng, ByteP reg, char *name, unsigned char mask) * on consecutive small fills. */ #define SET_XYDIR(dir) \ - if ((dir) != tseng_old_dir) \ - *ACL_XY_DIRECTION = tseng_old_dir = (dir); + if ((dir) != pTseng->tseng_old_dir) \ + pTseng->tseng_old_dir = (dir); \ + ACL_XY_DIRECTION(pTseng->tseng_old_dir); #endif #define SET_SECONDARY_XYDIR(dir) \ - *ACL_SECONDARY_EDGE = (dir); + ACL_SECONDARY_EDGE(dir); /* Must do 0x09 (in one operation) for the W32 */ #define START_ACL(pTseng, dst) \ - *(ACL_DESTINATION_ADDRESS) = dst; \ - if (Is_W32 || Is_W32i) *ACL_OPERATION_STATE = 0x09; + ACL_DESTINATION_ADDRESS(dst); \ + if (Is_W32 || Is_W32i) ACL_OPERATION_STATE(0x09); /* START_ACL for the ET6000 */ #define START_ACL_6(dst) \ - *(ACL_DESTINATION_ADDRESS) = dst; + ACL_DESTINATION_ADDRESS(dst); #define START_ACL_CPU(pTseng, dst) \ if (Is_W32 || Is_W32i) \ - *((LongP) (MMioBase + 0x08)) = (CARD32)dst; /* writing to MMU2 will trigger accel at this address */ \ + MMIO_OUT32(pTseng->MMioBase, 0x08<<8,(CARD32)dst); /* writing to MMU2 will trigger accel at this address */ \ else \ - *(ACL_DESTINATION_ADDRESS) = dst; + ACL_DESTINATION_ADDRESS(dst); -/* *(ACL_DESTINATION_ADDRESS) = dst; should be enough for START_ACL_CPU */ +/* ACL_DESTINATION_ADDRESS(dst); should be enough for START_ACL_CPU */ /***********************************************************************/ @@ -239,3 +229,4 @@ Bool TsengXAAInit(ScreenPtr pScreen); Bool TsengXAAInit_Colexp(ScrnInfoPtr pScrn); #endif + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c index f5831b6f1..e0d6136f6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c,v 1.3 1998/08/02 05:17:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_bank.c,v 1.4 2000/08/08 08:58:06 eich Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c index 012e35ab7..27d9385e7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c,v 1.15 2000/06/21 17:28:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c,v 1.16 2000/08/08 08:58:06 eich Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c index b9ca76492..5b9ff4479 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c,v 1.10 1999/09/25 14:37:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c,v 1.12 2000/08/08 08:58:06 eich Exp $ */ @@ -237,8 +237,8 @@ TsengXAAInit_Colexp(ScrnInfoPtr pScrn) TsengSubsequentCPUToScreenColorExpandFill; /* we'll be using MMU aperture 2 */ - pXAAInfo->ColorExpandBase = tsengCPU2ACLBase; - /* ErrorF("tsengCPU2ACLBase = 0x%x\n", tsengCPU2ACLBase); */ + pXAAInfo->ColorExpandBase = (CARD8 *)pTseng->tsengCPU2ACLBase; + /* ErrorF("tsengCPU2ACLBase = 0x%x\n", pTseng->tsengCPU2ACLBase); */ /* aperture size is 8kb in banked mode. Larger in linear mode, but 8kb is enough */ pXAAInfo->ColorExpandRange = 8192; } @@ -248,12 +248,12 @@ TsengXAAInit_Colexp(ScrnInfoPtr pScrn) #define SET_FUNCTION_COLOREXPAND \ if (Is_ET6K) \ - *ACL_MIX_CONTROL = 0x32; \ + ACL_MIX_CONTROL(0x32); \ else \ - *ACL_ROUTING_CONTROL = 0x08; + ACL_ROUTING_CONTROL(0x08); #define SET_FUNCTION_COLOREXPAND_CPU \ - *ACL_ROUTING_CONTROL = 0x02; + ACL_ROUTING_CONTROL(0x02); static CARD32 ColorExpandDst; static int ce_skipleft; @@ -282,7 +282,7 @@ TsengSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); #if 0 - *ACL_MIX_Y_OFFSET = w - 1; + ACL_MIX_Y_OFFSET(w - 1); ErrorF(" W=%d", w); #endif @@ -297,7 +297,7 @@ TsengSubsequentColorExpandScanline(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); - *ACL_MIX_ADDRESS = (pTseng->AccelColorExpandBufferOffsets[bufno] << 3) + ce_skipleft; + ACL_MIX_ADDRESS((pTseng->AccelColorExpandBufferOffsets[bufno] << 3) + ce_skipleft); START_ACL(pTseng, ColorExpandDst); /* move to next scanline */ @@ -326,8 +326,8 @@ TsengSubsequentColorExpandScanline(ScrnInfoPtr pScrn, void TsengSubsequentColorExpandScanline_8bpp(ScrnInfoPtr pScrn, int bufno) { TsengPtr pTseng = TsengPTR(pScrn); - CARD8 *dest = (CARD8 *) tsengCPU2ACLBase; - int i; + memType dest = pTseng->tsengCPU2ACLBase; + int i,j; CARD8 *bufptr; i = colexp_width_bytes; @@ -337,11 +337,11 @@ void TsengSubsequentColorExpandScanline_8bpp(ScrnInfoPtr pScrn, int bufno) START_ACL (pTseng, ColorExpandDst); /* *((LongP) (MMioBase + 0x08)) = (CARD32) ColorExpandDst;*/ -/* *(CARD32*)tsengCPU2ACLBase = (CARD32)ColorExpandDst; */ - +/* MMIO_OUT32(tsengCPU2ACLBase,0, (CARD32)ColorExpandDst); */ + j = 0; /* Copy scanline data to accelerator MMU aperture byte by byte */ while (i--) { /* FIXME: we need to take care of PCI bursting and MMU overflow here! */ - *dest++ = *bufptr++; + MMIO_OUT8(dest,j++, *bufptr++); } /* move to next scanline */ @@ -357,21 +357,22 @@ void TsengSubsequentColorExpandScanline_8bpp(ScrnInfoPtr pScrn, int bufno) void TsengSubsequentColorExpandScanline_16bpp(ScrnInfoPtr pScrn, int bufno) { TsengPtr pTseng = TsengPTR(pScrn); - CARD8 *dest = (CARD8 *) tsengCPU2ACLBase; - int i; + memType dest = pTseng->tsengCPU2ACLBase; + int i,j; CARD8 *bufptr; register CARD32 bits16; - + i = colexp_width_dwords * 2; bufptr = (CARD8 *) (pTseng->XAAScanlineColorExpandBuffers[bufno]); wait_acl_queue(pTseng); START_ACL(pTseng, ColorExpandDst); + j = 0; while (i--) { bits16 = pTseng->ColExpLUT[*bufptr++]; - *dest++ = bits16 & 0xFF; - *dest++ = (bits16 >> 8) & 0xFF; + MMIO_OUT8(dest,j++,bits16 & 0xFF); + MMIO_OUT8(dest,j++,(bits16 >> 8) & 0xFF); } /* move to next scanline */ @@ -387,8 +388,8 @@ void TsengSubsequentColorExpandScanline_16bpp(ScrnInfoPtr pScrn, int bufno) void TsengSubsequentColorExpandScanline_24bpp(ScrnInfoPtr pScrn, int bufno) { TsengPtr pTseng = TsengPTR(pScrn); - CARD8 *dest = (CARD8 *) tsengCPU2ACLBase; - int i, j = -1; + memType dest = pTseng->tsengCPU2ACLBase; + int i, k, j = -1; CARD8 *bufptr; register CARD32 bits24; @@ -400,12 +401,13 @@ void TsengSubsequentColorExpandScanline_24bpp(ScrnInfoPtr pScrn, int bufno) /* take 8 input bits, expand to 3 output bytes */ bits24 = pTseng->ColExpLUT[*bufptr++]; + k = 0; while (i--) { if ((j++) == 2) { /* "i % 3" operation is much to expensive */ j = 0; bits24 = pTseng->ColExpLUT[*bufptr++]; } - *dest++ = bits24 & 0xFF; + MMIO_OUT8(dest,k++,bits24 & 0xFF); bits24 >>= 8; } @@ -422,8 +424,8 @@ void TsengSubsequentColorExpandScanline_24bpp(ScrnInfoPtr pScrn, int bufno) void TsengSubsequentColorExpandScanline_32bpp(ScrnInfoPtr pScrn, int bufno) { TsengPtr pTseng = TsengPTR(pScrn); - CARD8 *dest = (CARD8 *) tsengCPU2ACLBase; - int i; + memType dest = pTseng->tsengCPU2ACLBase; + int i,j; CARD8 *bufptr; register CARD32 bits32; @@ -433,12 +435,13 @@ void TsengSubsequentColorExpandScanline_32bpp(ScrnInfoPtr pScrn, int bufno) wait_acl_queue(pTseng); START_ACL(pTseng, ColorExpandDst); + j = 0; while (i--) { bits32 = pTseng->ColExpLUT[*bufptr++]; - *dest++ = bits32 & 0xFF; - *dest++ = (bits32 >> 8) & 0xFF; - *dest++ = (bits32 >> 16) & 0xFF; - *dest++ = (bits32 >> 24) & 0xFF; + MMIO_OUT8(dest,j++,bits32 & 0xFF); + MMIO_OUT8(dest,j++,(bits32 >> 8) & 0xFF); + MMIO_OUT8(dest,j++,(bits32 >> 16) & 0xFF); + MMIO_OUT8(dest,j++,(bits32 >> 24) & 0xFF); } /* move to next scanline */ @@ -457,7 +460,7 @@ void TsengSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, /* ErrorF("X"); */ - PINGPONG(); + PINGPONG(pTseng); wait_acl_queue(pTseng); @@ -471,7 +474,7 @@ void TsengSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, SET_FUNCTION_COLOREXPAND_CPU; /* assure correct alignment of MIX address (ACL needs same alignment here as in MMU aperture) */ - *ACL_MIX_ADDRESS = 0; + ACL_MIX_ADDRESS(0); } /* @@ -498,7 +501,7 @@ void TsengSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, ErrorF("=========WAIT FIXME!\n"); WAIT_INTERFACE; - *ACL_MIX_Y_OFFSET = w - 1; + ACL_MIX_Y_OFFSET(w - 1); SET_XY(pTseng, w, h); START_ACL(pTseng, destaddr); } @@ -512,7 +515,7 @@ TsengSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, /* ErrorF("SSC "); */ - PINGPONG(); + PINGPONG(pTseng); wait_acl_queue(pTseng); @@ -538,10 +541,10 @@ TsengSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, wait_acl_queue(pTseng); SET_XY(pTseng, w, h); - *ACL_MIX_ADDRESS = /* MIX address is in BITS */ - (((srcy * pScrn->displayWidth) + srcx) * pScrn->bitsPerPixel) + skipleft; + ACL_MIX_ADDRESS( /* MIX address is in BITS */ + (((srcy * pScrn->displayWidth) + srcx) * pScrn->bitsPerPixel) + skipleft); - *ACL_MIX_Y_OFFSET = pTseng->line_width << 3; + ACL_MIX_Y_OFFSET(pTseng->line_width << 3); START_ACL(pTseng, destaddr); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c index d27763a4b..915bd6d1e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c,v 1.14 1998/08/29 14:34:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c,v 1.15 2000/08/08 08:58:06 eich Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c index 8f93d0cb2..a7b29e755 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c,v 1.8 1999/06/12 07:18:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c,v 1.9 2000/08/08 08:58:06 eich Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c index c839cde9a..53ee0c6d8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.69 2000/04/17 16:30:09 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.71 2000/08/09 02:19:45 tsi Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -411,6 +411,7 @@ TsengLock(void) * This code is only called when the chipset is not given beforehand, * and if the PCI code hasn't detected one previously. */ +#if 0 static Bool ET4000MinimalProbe(void) { @@ -450,6 +451,7 @@ ET4000MinimalProbe(void) } return TRUE; } +#endif static int TsengFindIsaDevice(GDevPtr dev) @@ -1964,7 +1966,7 @@ TsengScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Map the Tseng memory areas */ if (!TsengMapMem(pScrn)) return FALSE; - + /* Save the current state */ TsengSave(pScrn); @@ -2297,10 +2299,37 @@ TsengMapMem(ScrnInfoPtr pScrn) "Could not mmap linear video memory.\n"); return FALSE; } + if (pTseng->UseAccel) { + pTseng->MMioBase = (memType)xf86MapPciMem(pScrn->scrnIndex, + VIDMEM_MMIO, + pTseng->PciTag, + (unsigned long)pTseng->LinFbAddress, + pTseng->FbMapSize); + if (!pTseng->MMioBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not mmap mmio memory.\n"); + return FALSE; + } + pTseng->MMioBase += 0x3FFF00L; + } } else { - pTseng->FbBase = VGAHWPTR(pScrn)->Base; + vgaHWPtr hwp = VGAHWPTR(pScrn); + if (pTseng->UseAccel) { + pTseng->FbBase = hwp->Base; + pTseng->MMioBase = (memType)xf86MapPciMem(pScrn->scrnIndex, + VIDMEM_MMIO, + pTseng->PciTag, + (unsigned long)hwp->MapPhys, + hwp->MapSize); + if (!pTseng->MMioBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not mmap mmio memory.\n"); + return FALSE; + } + pTseng->MMioBase += 0x1FF00L; + } } - + if (pTseng->FbBase == NULL) return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h index 23149a968..bc2ba77f8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h @@ -1,8 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h,v 1.6 1998/09/05 06:36:56 dawes Exp $ */ - - - - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_inline.h,v 1.8 2000/08/08 08:58:07 eich Exp $ */ #include "tseng.h" @@ -36,30 +32,31 @@ COLOR_REPLICATE_DWORD(TsengPtr pTseng, int color) static __inline__ void SET_FG_COLOR(TsengPtr pTseng, int color) { - *ACL_SOURCE_ADDRESS = tsengFg; - *ACL_SOURCE_Y_OFFSET = 3; + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengFg); + ACL_SOURCE_Y_OFFSET(3); color = COLOR_REPLICATE_DWORD(pTseng, color); - *tsengMemFg = color; + MMIO_OUT32(pTseng->scratchMemBase, pTseng->tsengFg, color); + if (Is_W32p || Is_ET6K) { - *ACL_SOURCE_WRAP = 0x02; + ACL_SOURCE_WRAP(0x02); } else { - *(tsengMemFg + 1) = color; - *ACL_SOURCE_WRAP = 0x12; + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengFg + 4, color); + ACL_SOURCE_WRAP(0x12); } } static __inline__ void SET_BG_COLOR(TsengPtr pTseng, int color) { - *ACL_PATTERN_ADDRESS = tsengPat; - *ACL_PATTERN_Y_OFFSET = 3; + ACL_PATTERN_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengPat); + ACL_PATTERN_Y_OFFSET(3); color = COLOR_REPLICATE_DWORD(pTseng, color); - *tsengMemPat = color; + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengPat, color); if (Is_W32p || Is_ET6K) { - *ACL_PATTERN_WRAP = 0x02; + ACL_PATTERN_WRAP(0x02); } else { - *(tsengMemPat + 1) = color; - *ACL_PATTERN_WRAP = 0x12; + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengPat + 4, color); + ACL_PATTERN_WRAP(0x12); } } @@ -72,19 +69,19 @@ SET_BG_COLOR(TsengPtr pTseng, int color) static __inline__ void SET_FG_BG_COLOR(TsengPtr pTseng, int fgcolor, int bgcolor) { - *ACL_PATTERN_ADDRESS = tsengPat; - *ACL_SOURCE_ADDRESS = tsengFg; - *((LongP) ACL_PATTERN_Y_OFFSET) = 0x00030003; + ACL_PATTERN_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengPat); + ACL_SOURCE_ADDRESS(pTseng->AccelColorBufferOffset + pTseng->tsengFg); + ACL_PATTERN_Y_OFFSET32(0x00030003); fgcolor = COLOR_REPLICATE_DWORD(pTseng, fgcolor); bgcolor = COLOR_REPLICATE_DWORD(pTseng, bgcolor); - *tsengMemFg = fgcolor; - *tsengMemPat = bgcolor; + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengFg, fgcolor); + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengPat, bgcolor); if (Is_W32p || Is_ET6K) { - *((LongP) ACL_PATTERN_WRAP) = 0x00020002; + ACL_PATTERN_WRAP32(0x00020002); } else { - *(tsengMemFg + 1) = fgcolor; - *(tsengMemPat + 1) = bgcolor; - *((LongP) ACL_PATTERN_WRAP) = 0x00120012; + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengFg + 4, fgcolor); + MMIO_OUT32(pTseng->scratchMemBase,pTseng->tsengPat + 4, bgcolor); + ACL_PATTERN_WRAP32(0x00120012); } } @@ -115,7 +112,7 @@ CALC_XY(TsengPtr pTseng, int x, int y) { int new_x, xy; - if ((old_y == y) && (old_x == x)) + if ((pTseng->old_y == y) && (pTseng->old_x == x)) return -1; if (Is_W32p) @@ -123,8 +120,8 @@ CALC_XY(TsengPtr pTseng, int x, int y) else new_x = MULBPP(pTseng, x) - 1; xy = ((y - 1) << 16) + new_x; - old_x = x; - old_y = y; + pTseng->old_x = x; + pTseng->old_y = y; return xy; } @@ -138,9 +135,9 @@ SET_XY(TsengPtr pTseng, int x, int y) new_x = MULBPP(pTseng, x - 1); else new_x = MULBPP(pTseng, x) - 1; - *ACL_XY_COUNT = ((y - 1) << 16) + new_x; - old_x = x; - old_y = y; + ACL_XY_COUNT(((y - 1) << 16) + new_x); + pTseng->old_x = x; + pTseng->old_y = y; } static __inline__ void @@ -152,9 +149,9 @@ SET_X_YRAW(TsengPtr pTseng, int x, int y) new_x = MULBPP(pTseng, x - 1); else new_x = MULBPP(pTseng, x) - 1; - *ACL_XY_COUNT = (y << 16) + new_x; - old_x = x; - old_y = y - 1; /* old_y is invalid (raw transfer) */ + ACL_XY_COUNT((y << 16) + new_x); + pTseng->old_x = x; + pTseng->old_y = y - 1; /* old_y is invalid (raw transfer) */ } /* @@ -172,11 +169,11 @@ SET_XY_4(TsengPtr pTseng, int x, int y) { int new_xy; - if ((old_y != y) || (old_x != x)) { + if ((pTseng->old_y != y) || (pTseng->old_x != x)) { new_xy = ((y - 1) << 16) + MULBPP(pTseng, x - 1); - *ACL_XY_COUNT = new_xy; - old_x = x; - old_y = y; + ACL_XY_COUNT(new_xy); + pTseng->old_x = x; + pTseng->old_y = y; } } @@ -185,45 +182,39 @@ SET_XY_6(TsengPtr pTseng, int x, int y) { int new_xy; /* using this intermediate variable is faster */ - if ((old_y != y) || (old_x != x)) { + if ((pTseng->old_y != y) || (pTseng->old_x != x)) { new_xy = ((y - 1) << 16) + MULBPP(pTseng, x) - 1; - *ACL_XY_COUNT = new_xy; - old_x = x; - old_y = y; + ACL_XY_COUNT(new_xy); + pTseng->old_x = x; + pTseng->old_y = y; } } /* generic SET_XY_RAW */ static __inline__ void -SET_XY_RAW(int x, int y) +SET_XY_RAW(TsengPtr pTseng,int x, int y) { - *ACL_XY_COUNT = (y << 16) + x; - old_x = old_y = -1; /* invalidate old_x/old_y (raw transfers) */ + ACL_XY_COUNT((y << 16) + x); + pTseng->old_x = pTseng->old_y = -1; /* invalidate old_x/old_y (raw transfers) */ } static __inline__ void -PINGPONG(void) +PINGPONG(TsengPtr pTseng) { - if (tsengFg == W32ForegroundPing) { - tsengMemFg = MemW32ForegroundPong; - tsengFg = W32ForegroundPong; - tsengMemBg = MemW32BackgroundPong; - tsengBg = W32BackgroundPong; - tsengMemPat = MemW32PatternPong; - tsengPat = W32PatternPong; + if (pTseng->tsengFg == 0) { + pTseng->tsengFg = 8; + pTseng->tsengBg = 24; + pTseng->tsengPat = 40; } else { - tsengMemFg = MemW32ForegroundPing; - tsengFg = W32ForegroundPing; - tsengMemBg = MemW32BackgroundPing; - tsengBg = W32BackgroundPing; - tsengMemPat = MemW32PatternPing; - tsengPat = W32PatternPing; + pTseng->tsengFg = 0; + pTseng->tsengBg = 16; + pTseng->tsengPat = 32; } } /* * This is called in each ACL function just before the first ACL register is - * written to. It waits for the accelerator to finish on cards that don't +x * written to. It waits for the accelerator to finish on cards that don't * support hardware-wait-state locking, and waits for a free queue entry on * others, if hardware-wait-states are not enabled. */ @@ -235,4 +226,3 @@ wait_acl_queue(TsengPtr pTseng) if (pTseng->need_wait_acl) WAIT_ACL; } - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c index f5f9ed3d1..7a4c6f8f0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.22 1998/08/19 14:05:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.23 2000/08/08 08:58:07 eich Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c index 987543bf1..9726b8219 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.44 2000/04/27 16:26:49 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.45 2000/08/04 16:13:37 eich Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -825,8 +825,10 @@ GenericCloseScreen(int scrnIndex, ScreenPtr pScreen) Closed = (*pScreen->CloseScreen)(scrnIndex, pScreen); } - GenericLeaveGraphics(pScreenInfo); - pScreenInfo->vtSema = FALSE; + if (pScreenInfo->vtSema) { + GenericLeaveGraphics(pScreenInfo); + pScreenInfo->vtSema = FALSE; + } return Closed; } diff --git a/xc/programs/Xserver/hw/xfree86/etc/Imakefile b/xc/programs/Xserver/hw/xfree86/etc/Imakefile index 07a1477d2..944a1096d 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/etc/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/24 1996/10/28 04:24:12 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.36 2000/02/24 18:50:44 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.37 2000/07/30 17:12:21 dawes Exp $ #include <Server.tmpl> #if SystemV @@ -92,6 +92,7 @@ AllTarget(ProgramTargetName(scanpci)) NormalProgramTarget(scanpci,scanpci.o,NullParameter,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(scanpci,$(BINDIR)) +InstallManPage(scanpci,$(MANDIR)) #endif #if JoystickSupport || Joystick2Support @@ -108,6 +109,7 @@ InstallProgram(joycal,$(BINDIR)) AllTarget(ProgramTargetName(pcitweak)) NormalProgramTarget(pcitweak,pcitweak.o,NullParameter,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(pcitweak,$(BINDIR)) +InstallManPage(pcitweak,$(MANDIR)) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) diff --git a/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh b/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh index b2dd8279c..c38c1814c 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh +++ b/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.13 2000/06/30 21:44:37 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.14 2000/07/06 23:39:04 dawes Exp $ # # Copyright © 2000 by Precision Insight, Inc. # Copyright © 2000 by VA Linux Systems, Inc. @@ -301,6 +301,10 @@ DoOsChecks() ELF) # Check ldconfig LDSO=`/sbin/ldconfig -v -n | awk '{ print $3 }'` + # if LDSO is empty ldconfig may be Version 2 + if [ X"$LDSO" = X ]; then + LDSO=`/sbin/ldconfig -V | awk 'NR == 1 { print $4 }'` + fi LDSOMIN=`echo $LDSO | awk -F[.-] '{ print $3 }'` LDSOMID=`echo $LDSO | awk -F[.-] '{ print $2 }'` LDSOMAJ=`echo $LDSO | awk -F[.-] '{ print $1 }'` diff --git a/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c b/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c index 92aef48e9..069f2abbf 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c +++ b/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c @@ -5,7 +5,7 @@ * * Author: David Dawes <dawes@xfree86.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.13 2000/02/13 03:06:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.14 2000/08/10 17:40:34 dawes Exp $ */ #include "X.h" #include "os.h" @@ -14,6 +14,10 @@ #include "xf86_OSproc.h" #include "xf86Pci.h" +#ifdef __CYGWIN__ +#include <getopt.h> +#endif + #include <stdarg.h> #include <stdlib.h> #ifdef __linux__ diff --git a/xc/programs/Xserver/hw/xfree86/etc/pcitweak.man b/xc/programs/Xserver/hw/xfree86/etc/pcitweak.man new file mode 100644 index 000000000..df177915e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/etc/pcitweak.man @@ -0,0 +1,64 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.man,v 3.1 2000/07/30 17:12:21 dawes Exp $ +.TH PCITWEAK 1 "Version 4.0.1" "XFree86" +.SH NAME +pcitweak - read/write PCI config space +.SH SYNOPSIS +.B pcitweak +.B \-l +.br +.B pcitweak +.B \-r +.I PCI-ID +.RB [ \-b | \-h ] +.I offset +.br +.B pcitweak +.B \-w +.I PCI-ID +.RB [ \-b | \-h ] +.I offset +.I value +.SH DESCRIPTION +.I Pcitweak +is a utility that can be used to examine or change registers in the PCI +configuration space. On most platfoms +.I pcitweak +can only be run by the root user. +.SH OPTIONS +.TP 8 +.B \-l +Probe the PCI buses and print a line for each detected device. Each line +contains the bus location (bus:device:function), chip vendor/device, card +(subsystem) vendor/card, revision, class and header type. All values +printed are in hexadecimal. +.TP 8 +.BI "\-r " PCI-ID +Read the PCI configuration space register at +.I offset +for the PCI device at bus location +.IR PCI-ID . +.I PCI-ID +should be given in the form bus:device:function, with each value in +hexadecimal. By default, a 32-bit register is read. +.TP 8 +.BI "\-w " PCI-ID +Write +.I value +to the PCI configuration space register at +.I offset +for the PCI device at bus location +.IR PCI-ID . +.I PCI-ID +should be given in the form bus:device:function, with each value in +hexadecimal. By default, a 32-bit register is written. +.TP 8 +.B \-b +Read or write an 8-bit value (byte). +.TP 8 +.B \-h +Read or write a 16-bit value (halfword). +.SH "SEE ALSO" +scanpci(1) +.SH AUTHORS +David Dawes +.RI ( dawes@xfree86.org ). diff --git a/xc/programs/Xserver/hw/xfree86/etc/scanpci.man b/xc/programs/Xserver/hw/xfree86/etc/scanpci.man new file mode 100644 index 000000000..6f964aa70 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/etc/scanpci.man @@ -0,0 +1,42 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.man,v 3.1 2000/07/30 17:12:22 dawes Exp $ +.TH SCANPCI 1 "Version 4.0.1" "XFree86" +.SH NAME +scanpci - scan/probe PCI buses +.SH SYNOPSIS +.B scanpci +.RB [ \-v12OfV ] +.SH DESCRIPTION +.I Scanpci +is a utility that can be used to scan PCI buses and report information +about the configuration space settings for each PCI device. +On most platforms, +.I scanpci +can only be run by the root user. +.SH OPTIONS +.TP 8 +.B \-v +Print the configuration space information for each device in a verbose +format. Without this option, only a brief description is printed for +each device. +.TP 8 +.B \-1 +Use PCI config type 1. +.TP 8 +.B \-2 +Use PCI config type 2. +.TP 8 +.B \-f +Used in conjunction with the above two options, this forces the specified +configuration type to be used for config space access. +.TP 8 +.B \-O +Use the OS's PCI config space access mechanism to access the PCI config +space (when available). +.TP 8 +.BI "\-V " n +Set the verbosity level to +.I n +for the internal PCI scanner. This is primarily for debugging use. +.SH "SEE ALSO" +pcitweak(1) +.SH AUTHORS diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile b/xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile index b8f3f6265..2d87ff273 100644 --- a/xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.6 1999/08/14 10:49:58 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.8 2000/08/11 23:33:50 dawes Exp $ #define IHaveModules #include <Server.tmpl> diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c index 620e99b84..3064fa703 100644 --- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.15 2000/07/01 01:40:46 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.18 2000/08/11 23:33:50 dawes Exp $ */ /* all driver need this */ #include "xf86.h" @@ -16,6 +16,12 @@ #include "asm/page.h" /* #define for PAGE_* */ +#ifdef DPMSExtension +#include "globals.h" +#define DPMS_SERVER +#include "extensions/dpms.h" +#endif + #define DEBUG 0 #if DEBUG @@ -751,3 +757,32 @@ fbdevHWLeaveVT(int scrnIndex, int flags) fbdevHWRestore(pScrn); } +void +fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +{ +#ifdef DPMSExtension + fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); + int fbmode; + + if (!pScrn->vtSema) + return; + + switch (mode) { + case DPMSModeOn: + fbmode = 0; + break; + case DPMSModeStandby: + fbmode = 2; + break; + case DPMSModeSuspend: + fbmode = 3; + break; + case DPMSModeOff: + fbmode = 4; + break; + } + + if (-1 == ioctl(fPtr->fd, FBIOBLANK, fbmode)) + perror("ioctl FBIOBLANK"); +#endif /* DPMSExtension */ +} diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h index a55edc81f..53312bb2f 100644 --- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h +++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.6 2000/04/17 16:30:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.7 2000/08/11 17:27:14 dawes Exp $ */ #define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */ #define FBDEVHW_PLANES 1 /* Non interleaved planes */ @@ -38,3 +38,4 @@ Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); void fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags); Bool fbdevHWEnterVT(int scrnIndex, int flags); void fbdevHWLeaveVT(int scrnIndex, int flags); +void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c index 502c6975c..516d2b2eb 100644 --- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c +++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.7 2000/05/18 16:29:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.8 2000/08/11 17:27:14 dawes Exp $ */ #include "xf86.h" #include "xf86cmap.h" @@ -152,3 +152,7 @@ fbdevHWLeaveVT(int scrnIndex, int flags) { } +void +fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +{ +} diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h index 43d2edeac..d651e5129 100644 --- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h +++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h @@ -2,7 +2,7 @@ * copyed from from linux kernel 2.2.4 * removed internal stuff (#ifdef __KERNEL__) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h,v 1.2 2000/01/21 02:30:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbpriv.h,v 1.3 2000/08/11 17:27:14 dawes Exp $ */ #ifndef _LINUX_FB_H #define _LINUX_FB_H @@ -32,6 +32,7 @@ /* #define FBIOSWITCH_MONIBIT 0x460E */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 +#define FBIOBLANK 0x4611 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ diff --git a/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c new file mode 100644 index 000000000..7f1476a6d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c @@ -0,0 +1,1489 @@ +/* + * Copyright 1996 by Steven Lang <tiger@tyger.org> + * + * 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 Steven Lang not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. Steven Lang makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * STEVEN LANG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL STEVEN LANG 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 ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Steve Harris <steve@totl.net>, 2000-02-23 + * Southampton, UK + * + * Based on the xf86Summa driver, exensively hacked. Most of the bad + * indenting is not my fault, dammit! + * + * Probably buggy as hell, no idea what the initialisation strings are, + * no idea how to ack it. If the tablet stops responding power cycle it. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.1 2000/08/11 19:10:41 dawes Exp $ */ + +#include <xf86Version.h> + +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) +#define XFREE86_V4 1 +#endif + +#ifdef XFREE86_V4 +/* post 3.9 headers */ + +#ifndef XFree86LOADER +#include <unistd.h> +#include <errno.h> +#endif + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#if !defined(DGUX) +#include <xf86_ansic.h> +#include <xisb.h> +#endif +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ +#include <keysym.h> +#include <mipointer.h> + +#ifdef XFree86LOADER +#include <xf86Module.h> +#endif + +#undef memset +#define memset xf86memset +#undef sleep +#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) +#define wait_for_fd(fd) xf86WaitForInput((fd), 1000) +#define tcflush(fd, n) xf86FlushInput((fd)) +#undef read +#define read(a,b,c) xf86ReadSerial((a),(b),(c)) +#undef write +#define write(a,b,c) xf86WriteSerial((a),(char*)(b),(c)) +#undef close +#define close(a) xf86CloseSerial((a)) +#define XCONFIG_PROBED "(==)" +#define XCONFIG_GIVEN "(**)" +#define xf86Verbose 1 +#undef PRIVATE +#define PRIVATE(x) XI_PRIVATE(x) + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ + +static const char *default_options[] = +{ + "BaudRate", "9600", + "DataBits", "8", + "StopBits", "1", + "Parity", "Odd", + "FlowControl", "Xoff", + "VTime", "10", + "VMin", "1", + NULL +}; + +static InputDriverPtr dedgeDrv; + +#else /* pre 3.9 headers */ + +#include "Xos.h" +#include <signal.h> +#include <stdio.h> + +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "inputstr.h" +#include "scrnintstr.h" +#include "XI.h" +#include "XIproto.h" + +#if defined(sun) && !defined(i386) +#define POSIX_TTY +#include <errno.h> +#include <termio.h> +#include <fcntl.h> +#include <ctype.h> + +#include "extio.h" +#else +#include "compiler.h" + +#ifdef XFree86LOADER +#include "xf86_libc.h" +#endif +#include "xf86.h" +#include "xf86Procs.h" +#include "xf86_OSlib.h" +#include "xf86_Config.h" +#include "xf86Xinput.h" +#include "atKeynames.h" +#include "xf86Version.h" +#endif + +#if !defined(sun) || defined(i386) +#include "osdep.h" +#include "exevents.h" + +#include "extnsionst.h" +#include "extinit.h" +#endif + +#if defined(__QNX__) || defined(__QNXNTO__) +#define POSIX_TTY +#endif +#endif /* pre 3.9 headers */ + +/* +** Debugging macros +*/ +#ifdef DBG +#undef DBG +#endif +#ifdef DEBUG +#undef DEBUG +#endif + +static int debug_level = 10; +#define DEBUG 1 +#if DEBUG +#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} +#else +#define DBG(lvl, f) +#endif + +/* +** Device records +*/ +#define ABSOLUTE_FLAG 1 +#define STYLUS_FLAG 2 +#define COMPATIBLE_FLAG 4 + +typedef struct { + char *dedgeDevice; /* device file name */ + int dedgeInc; /* increment between transmits */ + int dedgeButTrans; /* button translation flags */ + int dedgeOldX; /* previous X position */ + int dedgeOldY; /* previous Y position */ + int dedgeOldProximity; /* previous proximity */ + int dedgeOldPush; /* previous buttons state */ + int dedgeOldBarrel; /* previous buttons state */ + int dedgeOldPressure; /* previous pen pressure */ + int dedgeMaxX; /* max X value */ + int dedgeMaxY; /* max Y value */ + int dedgeXSize; /* active area X size */ + int dedgeXOffset; /* active area X offset */ + int dedgeYSize; /* active area Y size */ + int dedgeYOffset; /* active area Y offset */ + int dedgeRes; /* resolution in lines per inch */ + int dedgeClickThresh; /* Click threshold in arbitary units */ + int flags; /* various flags */ + int dedgeIndex; /* number of bytes read */ + unsigned char dedgeData[5]; /* data read on the device */ +} DigitalEdgeDeviceRec, *DigitalEdgeDevicePtr; + +/* +** Configuration data +*/ +#define DEDGE_SECTION_NAME "DigitalEdge" + +#ifndef XFREE86_V4 + +#define PORT 1 +#define DEVICENAME 2 +#define THE_MODE 3 +#define CURSOR 4 +#define INCREMENT 5 +#define BORDER 6 +#define DEBUG_LEVEL 7 +#define HISTORY_SIZE 8 +#define ALWAYS_CORE 9 +#define ACTIVE_AREA 10 +#define ACTIVE_OFFSET 11 +#define COMPATIBLE 12 +#define CLICK_THRESHOLD 13 + +#if !defined(sun) || defined(i386) +static SymTabRec SumTab[] = { + {ENDSUBSECTION, "endsubsection"}, + {PORT, "port"}, + {DEVICENAME, "devicename"}, + {THE_MODE, "mode"}, + {CURSOR, "cursor"}, + {INCREMENT, "increment"}, + {BORDER, "border"}, + {DEBUG_LEVEL, "debuglevel"}, + {HISTORY_SIZE, "historysize"}, + {ALWAYS_CORE, "alwayscore"}, + {ACTIVE_AREA, "activearea"}, + {ACTIVE_OFFSET, "activeoffset"}, + {COMPATIBLE, "compatible"}, + {CLICK_THRESHOLD, "clickthreshold"}, + {-1, ""} +}; + +#define RELATIVE 1 +#define ABSOLUTE 2 + +static SymTabRec SumModeTabRec[] = { + {RELATIVE, "relative"}, + {ABSOLUTE, "absolute"}, + {-1, ""} +}; + +#define PUCK 1 +#define STYLUS 2 + +static SymTabRec SumPointTabRec[] = { + {PUCK, "puck"}, + {STYLUS, "stylus"}, + {-1, ""} +}; + +#endif +#endif /* Pre 3.9 headers */ + +/* +** Contants and macro +*/ +#define BUFFER_SIZE 256 /* size of reception buffer */ +#define XI_NAME "DIGITALEDGE" /* X device name for the stylus */ + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + +#define SS_TABID0 "0" /* Tablet ID 0 */ +#define SS_FIRMID "z?" /* Request firmware ID string */ +#define SS_CONFIG "a" /* Send configuration (max coords) */ + +#define SS_ABSOLUTE 'F' /* Absolute mode */ +#define SS_RELATIVE 'E' /* Relative mode */ + +#define SS_UPPER_ORIGIN "b" /* Origin upper left */ +#define SS_500LPI "h" /* 500 lines per inch */ + +#define SS_PROMPT_MODE "B" /* Prompt mode */ +#define SS_STREAM_MODE "@" /* Stream mode */ +#define SS_INCREMENT 'I' /* Set increment */ +#define SS_BINARY_FMT "zb" /* Binary reporting */ + +#define SS_PROMPT "P" /* Prompt for current position */ + +static const char *ss_initstr = + SS_TABID0 SS_UPPER_ORIGIN SS_BINARY_FMT SS_STREAM_MODE; + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x01 +#define TABID_BIT 0x20 +#define XSIGN_BIT 0x10 +#define YSIGN_BIT 0x08 +#define BUTTON_BITS 0x02 +#define COORD_BITS 0x7f + +/* +** External declarations +*/ + +#ifndef XFREE86_V4 + +#if defined(sun) && !defined(i386) +#define ENQUEUE suneqEnqueue +#else +#define ENQUEUE xf86eqEnqueue + +extern void xf86eqEnqueue( +#if NeedFunctionPrototypes + xEventPtr /*e */ +#endif + ); +#endif + +extern void miPointerDeltaCursor( +#if NeedFunctionPrototypes + int /*dx */ , + int /*dy */ , + unsigned long /*time */ +#endif + ); + +#if !defined(sun) || defined(i386) +/* +** xf86SumConfig +** Reads the DigitalEdge section from the XF86Config file +*/ +static Bool +xf86SumConfig(LocalDevicePtr * array, int inx, int max, LexPtr val) +{ + LocalDevicePtr dev = array[inx]; + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) (dev->private); + int token; + int mtoken; + + DBG(1, ErrorF("xf86SumConfig\n")); + + while ((token = xf86GetToken(SumTab)) != ENDSUBSECTION) { + switch (token) { + case DEVICENAME: + if (xf86GetToken(NULL) != STRING) + xf86ConfigError("Option string expected"); + else { + dev->name = strdup(val->str); + if (xf86Verbose) + ErrorF("%s DigitalEdge X device name is %s\n", + XCONFIG_GIVEN, dev->name); + } + break; + + case PORT: + if (xf86GetToken(NULL) != STRING) + xf86ConfigError("Option string expected"); + else { + priv->dedgeDevice = strdup(val->str); + if (xf86Verbose) + ErrorF("%s DigitalEdge port is %s\n", XCONFIG_GIVEN, + priv->dedgeDevice); + } + break; + + case THE_MODE: + mtoken = xf86GetToken(SumModeTabRec); + if ((mtoken == EOF) || (mtoken == STRING) + || (mtoken == + NUMBER)) xf86ConfigError("Mode type token expected"); + else { + switch (mtoken) { + case ABSOLUTE: + priv->flags |= ABSOLUTE_FLAG; + break; + case RELATIVE: + priv->flags &= ~ABSOLUTE_FLAG; + break; + default: + xf86ConfigError("Illegal Mode type"); + break; + } + } + break; + + case CURSOR: + mtoken = xf86GetToken(SumPointTabRec); + if ((mtoken == EOF) || (mtoken == STRING) + || (mtoken == + NUMBER)) xf86ConfigError("Cursor token expected"); + else { + switch (mtoken) { + case STYLUS: + priv->flags |= STYLUS_FLAG; + break; + case PUCK: + priv->flags &= ~STYLUS_FLAG; + break; + default: + xf86ConfigError("Illegal cursor type"); + break; + } + } + break; + + case INCREMENT: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeInc = val->num; + if (xf86Verbose) + ErrorF("%s DigitalEdge increment value is %d\n", + XCONFIG_GIVEN, priv->dedgeInc); + break; + + case CLICK_THRESHOLD: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeClickThresh = val->num; + if (xf86Verbose) + ErrorF("%s DigitalEdge click threshold is %d\n", + XCONFIG_GIVEN, priv->dedgeClickThresh); + break; + + case DEBUG_LEVEL: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + debug_level = val->num; + if (xf86Verbose) { +#if DEBUG + ErrorF("%s DigitalEdge debug level sets to %d\n", + XCONFIG_GIVEN, debug_level); +#else + ErrorF("%s DigitalEdge debug level not sets to %d because" + " debugging is not compiled\n", XCONFIG_GIVEN, + debug_level); +#endif + } + break; + + case HISTORY_SIZE: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + dev->history_size = val->num; + if (xf86Verbose) + ErrorF("%s DigitalEdge Motion history size is %d\n", + XCONFIG_GIVEN, dev->history_size); + break; + case COMPATIBLE: + priv->flags |= COMPATIBLE_FLAG; + if (xf86Verbose) + ErrorF + ("DigitalEdge compatible - will not query firmware ID\n"); + break; + + case ALWAYS_CORE: + xf86AlwaysCore(dev, TRUE); + if (xf86Verbose) + ErrorF("%s DigitalEdge device always stays core pointer\n", + XCONFIG_GIVEN); + break; + + case ACTIVE_AREA: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeXSize = val->num; + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeYSize = val->num; + ErrorF("%s DigitalEdge active area set to %d.%1dx%d.%1d" + " inches\n", XCONFIG_GIVEN, priv->dedgeXSize / 10, + priv->dedgeXSize % 10, priv->dedgeYSize / 10, + priv->dedgeYSize % 10); + break; + + case ACTIVE_OFFSET: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeXOffset = val->num; + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->dedgeYOffset = val->num; + if (xf86Verbose) + ErrorF + ("%s DigitalEdge active area offset set to %d.%1dx%d.%1d" + " inches\n", XCONFIG_GIVEN, priv->dedgeXOffset / 10, + priv->dedgeXOffset % 10, priv->dedgeYOffset / 10, + priv->dedgeYOffset % 10); + break; + + case EOF: + FatalError("Unexpected EOF (missing EndSubSection)"); + break; + + default: + xf86ConfigError("DigitalEdge subsection keyword expected"); + break; + } + } + + DBG(1, ErrorF("xf86SumConfig name=%s\n", priv->dedgeDevice)); + + return Success; +} +#endif +#endif /* pre 3.9 headers */ + +/* +** xf86SumConvert +** Convert valuators to X and Y. +*/ +static Bool +xf86SumConvert(LocalDevicePtr local, + int first, + int num, + int v0, + int v1, int v2, int v3, int v4, int v5, int *x, int *y) +{ + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; + + if (first != 0 || num == 1) + return FALSE; + + *x = v0 * screenInfo.screens[0]->width / 2430; + *y = v1 * screenInfo.screens[0]->height / 1950; + + DBG(6, ErrorF("Adjusted coords x=%d y=%d\n", *x, *y)); + + return TRUE; +} + +/* +** xf86SumReverseConvert +** Convert X and Y to valuators. +*/ +static Bool +xf86SumReverseConvert(LocalDevicePtr local, int x, int y, int *valuators) +{ + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; + + valuators[0] = ((x * 2430) / screenInfo.screens[0]->width) + priv->dedgeXOffset; + valuators[1] = ((y * 1950) / screenInfo.screens[0]->height) + priv->dedgeYOffset; + + + DBG(6, + ErrorF("Adjusted valuators v0=%d v1=%d\n", valuators[0], + valuators[1])); + + return TRUE; +} + +/* +** xf86SumReadInput +** Reads from the DigitalEdge and posts any new events to the server. +*/ +static void xf86SumReadInput(LocalDevicePtr local) +{ + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; + int len, loop; + int is_absolute; + int x, y, push, barrel, prox, pressure; + DeviceIntPtr device; + unsigned char buffer[BUFFER_SIZE]; + + DBG(7, ErrorF("xf86SumReadInput BEGIN device=%s fd=%d\n", + priv->dedgeDevice, local->fd)); + + SYSCALL(len = read(local->fd, buffer, sizeof(buffer))); + + if (len <= 0) { + Error("error reading DigitalEdge device"); + return; + } + + for (loop = 0; loop < len; loop++) { + +/* Format of 5 bytes data packet for DigitalEdge Tablets + Byte 1 + bit 7 Phasing bit always 1 + bit 6 Proximity bit + bit 5 Tablet ID + bit 4 X sign (Always 1 for absolute) + bit 3 Y sign (Always 1 for absolute) + bit 2-0 Button status + + Byte 2 + bit 7 Always 0 + bits 6-0 = X6 - X0 + + Byte 3 (Absolute mode only) + bit 7 Always 0 + bits 6-0 = X13 - X7 + + Byte 4 + bit 7 Always 0 + bits 6-0 = Y6 - Y0 + + Byte 5 (Absolute mode only) + bit 7 Always 0 + bits 6-0 = Y13 - Y7 +*/ + + if ((priv->dedgeIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ + DBG(6, + ErrorF("xf86SumReadInput bad magic number 0x%x\n", + buffer[loop]));; + continue; + } + + priv->dedgeData[priv->dedgeIndex++] = buffer[loop]; + + if (priv->dedgeIndex == 7) { +/* the packet is OK */ +/* reset char count for next read */ + priv->dedgeIndex = 0; + + if (priv->flags & ABSOLUTE_FLAG) { + x = (int) priv->dedgeData[1] + ((int) priv->dedgeData[2] << 7); + y = 1950 - ((int) priv->dedgeData[3] + ((int) priv->dedgeData[4] << 7)); + } else { + x = + priv->dedgeData[0] & XSIGN_BIT ? priv-> + dedgeData[1] : -priv->dedgeData[1]; + y = + priv->dedgeData[0] & YSIGN_BIT ? priv-> + dedgeData[2] : -priv->dedgeData[2]; + } + prox = (priv->dedgeData[0] & PROXIMITY_BIT) ? 1 : 0; + + pressure = priv->dedgeData[6] + (priv->dedgeData[5] >> 4) * 128; + push = pressure > priv->dedgeClickThresh?1:0; + if ((priv->dedgeOldPressure) < priv->dedgeClickThresh && pressure == 1022) { + push = 0; + } else { + priv->dedgeOldPressure = pressure; + } + if (priv->dedgeData[0] & BUTTON_BITS) { + barrel = 1; + } else { + barrel = 0; + } + + device = local->dev; + + DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbarrel=%d\tpressure=%d\n", + prox ? "true" : "false", x, y, barrel, + pressure)); + + is_absolute = (priv->flags & ABSOLUTE_FLAG); + +/* coordonates are ready we can send events */ + if (prox) { + if (!(priv->dedgeOldProximity)) + xf86PostProximityEvent(device, 1, 0, 3, x, y, pressure); + + if ( + (is_absolute + && ((priv->dedgeOldX != x) || (priv->dedgeOldY != y))) + || (!is_absolute && (x || y))) { + if (is_absolute || priv->dedgeOldProximity) { + xf86PostMotionEvent(device, is_absolute, 0, 3, x, + y, pressure); + } + } + if (priv->dedgeOldPush != push) { + int delta; + + delta = push - priv->dedgeOldPush; + + if (priv->dedgeOldPush != push) { + DBG(6, + ErrorF("xf86SumReadInput push delta=%d\n", delta)); + xf86PostButtonEvent(device, is_absolute, 1, + (delta > 0), 0, 3, x, y, pressure); + } + } + + if (priv->dedgeOldBarrel != barrel) { + int delta; + + delta = barrel - priv->dedgeOldBarrel; + + if (priv->dedgeOldBarrel != barrel) { + DBG(6, + ErrorF("xf86SumReadInput barrel delta=%d\n", delta)); + xf86PostButtonEvent(device, is_absolute, 2, + (delta > 0), 0, 3, x, y, pressure); + } + } + + priv->dedgeOldPush = push; + priv->dedgeOldBarrel = barrel; + priv->dedgeOldX = x; + priv->dedgeOldY = y; + priv->dedgeOldProximity = prox; + + } else { /* !PROXIMITY */ +/* Any changes in buttons are ignored when !proximity */ + if (priv->dedgeOldProximity) + xf86PostProximityEvent(device, 0, 0, 3, x, y, pressure); + priv->dedgeOldProximity = 0; + } + } + } + DBG(7, ErrorF("xf86Sum(priv->dedgeData[0] & BUTTON_BITS)iReadInput END device=0x%x priv=0x%x\n", + local->dev, priv)); +} + +/* +** xf86SumControlProc +** It really does do something. Honest! +*/ +static void xf86SumControlProc(DeviceIntPtr device, PtrCtrl * ctrl) +{ + DBG(2, ErrorF("xf86SumControlProc\n")); +} + +/* +** xf86SumWriteAndRead +** Write data, and get the response. +*/ +static char *xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, + int cr_term) +{ + int err, numread = 0; +#ifndef XFREE86_V4 + fd_set readfds; + struct timeval timeout; +#endif + + SYSCALL(err = write(fd, data, strlen(data))); + if (err == -1) { + Error("DigitalEdge write"); + return NULL; + } +#ifndef XFREE86_V4 + FD_ZERO(&readfds); + FD_SET(fd, &readfds); +#endif + while (numread < len) { +#ifndef XFREE86_V4 + timeout.tv_sec = 0; + timeout.tv_usec = 200000; + + SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); +#else + err = xf86WaitForInput(fd, 1000); +#endif + if (err == -1) { + Error("DigitalEdge select"); + return NULL; + } + if (!err) { + ErrorF + ("Timeout while reading DigitalEdge tablet. No tablet connected ???\n"); + return NULL; + } + + SYSCALL(err = read(fd, buffer + numread++, 1)); + if (err == -1) { + Error("DigitalEdge read"); + return NULL; + } + if (!err) { + --numread; + break; + } + if (cr_term && buffer[numread - 1] == '\r') { + buffer[numread - 1] = 0; + break; + } + } + buffer[numread] = 0; + return buffer; +} + +/* +** xf86SumOpen +** Open and initialize the tablet, as well as probe for any needed data. +*/ +static Bool xf86SumOpen(LocalDevicePtr local) +{ +#ifndef XFREE86_V4 + struct termios termios_tty; + struct timeval timeout; +#endif + char buffer[256]; + int err, idx; + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; + + DBG(1, ErrorF("opening %s\n", priv->dedgeDevice)); + +#ifdef XFREE86_V4 + local->fd = xf86OpenSerial(local->options); +#else + SYSCALL(local->fd = open(priv->dedgeDevice, O_RDWR | O_NDELAY, 0)); +#endif + if (local->fd == -1) { + Error(priv->dedgeDevice); + return !Success; + } + DBG(2, ErrorF("%s opened as fd %d\n", priv->dedgeDevice, local->fd)); + +#ifndef XFREE86_V4 +#ifdef POSIX_TTY + err = tcgetattr(local->fd, &termios_tty); + if (err == -1) { + Error("DigitalEdge tcgetattr"); + return !Success; + } + termios_tty.c_iflag = IXOFF; + termios_tty.c_cflag = + B9600 | CS8 | CREAD | CLOCAL | HUPCL | PARENB | PARODD; + termios_tty.c_lflag = 0; + +/* I wonder what these all do, anyway */ + termios_tty.c_cc[VINTR] = 0; + termios_tty.c_cc[VQUIT] = 0; + termios_tty.c_cc[VERASE] = 0; +#ifdef VWERASE + termios_tty.c_cc[VWERASE] = 0; +#endif +#ifdef VREPRINT + termios_tty.c_cc[VREPRINT] = 0; +#endif + termios_tty.c_cc[VKILL] = 0; + termios_tty.c_cc[VEOF] = 0; + termios_tty.c_cc[VEOL] = 0; +#ifdef VEOL2 + termios_tty.c_cc[VEOL2] = 0; +#endif + termios_tty.c_cc[VSUSP] = 0; +#ifdef VDISCARD + termios_tty.c_cc[VDISCARD] = 0; +#endif +#ifdef VLNEXT + termios_tty.c_cc[VLNEXT] = 0; +#endif + + termios_tty.c_cc[VMIN] = 1; + termios_tty.c_cc[VTIME] = 10; + + err = tcsetattr(local->fd, TCSANOW, &termios_tty); + if (err == -1) { + Error("DigitalEdge tcsetattr TCSANOW"); + return !Success; + } +#else + Code for someone + else + to write to handle OSs without POSIX tty functions +#endif +#endif + DBG(1, ErrorF("initializing DigitalEdge tablet\n")); + +/* Send reset (NULL) to the tablet */ + SYSCALL(err = write(local->fd, "", 1)); + if (err == -1) { + Error("DigitalEdge write"); + return !Success; + } + +/* wait 200 mSecs, just in case */ +#ifndef XFREE86_V4 + timeout.tv_sec = 0; + timeout.tv_usec = 200000; + SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); +#else + err = xf86WaitForInput(-1, 200); +#endif + if (err == -1) { + Error("DigitalEdge select"); + return !Success; + } + +/* Put it in prompt mode so it doens't say anything before we're ready */ + SYSCALL(err = + write(local->fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE))); + if (err == -1) { + Error("DigitalEdge write"); + return !Success; + } +/* Clear any pending input */ +#ifndef XFREE86_V4 + tcflush(local->fd, TCIFLUSH); +#else + xf86FlushInput(local->fd); +#endif + + if (priv->dedgeXOffset > 0 && priv->dedgeYOffset > 0) { + if (priv->dedgeXSize * 50 < priv->dedgeMaxX - priv->dedgeXOffset && + priv->dedgeYSize * 50 < priv->dedgeMaxY - priv->dedgeYOffset) { + priv->dedgeXOffset *= 50; + priv->dedgeYOffset *= 50; + } else { + ErrorF("%s DigitalEdge offset sets active area off tablet, " + "centering\n", XCONFIG_PROBED); + priv->dedgeXOffset = (priv->dedgeMaxX - priv->dedgeXSize) / 2; + priv->dedgeYOffset = (priv->dedgeMaxY - priv->dedgeYSize) / 2; + } + } else { + priv->dedgeXOffset = (priv->dedgeMaxX - priv->dedgeXSize) / 2; + priv->dedgeYOffset = (priv->dedgeMaxY - priv->dedgeYSize) / 2; + } + + if (priv->dedgeInc > 95) + priv->dedgeInc = 95; + if (priv->dedgeInc < 1) { +/* Make a guess as to the best increment value given video mode */ + if (priv->dedgeXSize / screenInfo.screens[0]->width < + priv->dedgeYSize / screenInfo.screens[0]->height) + priv->dedgeInc = priv->dedgeXSize / screenInfo.screens[0]->width; + else + priv->dedgeInc = priv->dedgeYSize / screenInfo.screens[0]->height; + if (priv->dedgeInc < 1) + priv->dedgeInc = 1; + if (xf86Verbose) + ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED, + priv->dedgeInc); + } + +/* Sets up the tablet mode to increment, stream, and such */ + for (idx = 0; ss_initstr[idx]; idx++) { + buffer[idx] = ss_initstr[idx]; + } + buffer[idx++] = SS_INCREMENT; + buffer[idx++] = 32 + priv->dedgeInc; + buffer[idx++] = + (priv->flags & ABSOLUTE_FLAG) ? SS_ABSOLUTE : SS_RELATIVE; + buffer[idx] = 0; + + SYSCALL(err = write(local->fd, buffer, idx)); + if (err == -1) { + Error("DigitalEdge write"); + return !Success; + } + + if (err <= 0) { + SYSCALL(close(local->fd)); + return !Success; + } + + if (priv->dedgeClickThresh <= 0) { + /* Make up a value */ + priv->dedgeClickThresh = 700; + } + + return Success; +} + +/* +** xf86SumOpenDevice +** Opens and initializes the device driver stuff or dedgepthin. +*/ +static int xf86SumOpenDevice(DeviceIntPtr pSum) +{ + LocalDevicePtr local = (LocalDevicePtr) pSum->public.devicePrivate; + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) PRIVATE(pSum); + + if (xf86SumOpen(local) != Success) { + if (local->fd >= 0) { + SYSCALL(close(local->fd)); + } + local->fd = -1; + } + +/* Set the real values */ + InitValuatorAxisStruct(pSum, 0, 0, /* min val */ + 2430, /* max val */ + 500, /* resolution */ + 0, /* min_res */ + 500); /* max_res */ + InitValuatorAxisStruct(pSum, 1, 0, /* min val */ + 1950, /* max val */ + 500, /* resolution */ + 0, /* min_res */ + 500); /* max_res */ + InitValuatorAxisStruct(pSum, 2, priv->dedgeClickThresh, /* min val */ + 1022, /* max val */ + 500, /* resolution */ + 0, /* min_res */ + 500); /* max_res */ + return (local->fd != -1); +} + +/* +** xf86SumProc +** Handle requests to do stuff to the driver. +*/ +static int xf86SumProc(DeviceIntPtr pSum, int what) +{ + CARD8 map[25]; + int nbaxes; + int nbbuttons; + int loop; + LocalDevicePtr local = (LocalDevicePtr) pSum->public.devicePrivate; + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) PRIVATE(pSum); + + DBG(2, + ErrorF("BEGIN xf86SumProc dev=0x%x priv=0x%x what=%d\n", pSum, + priv, what)); + + switch (what) { + case DEVICE_INIT: + DBG(1, ErrorF("xf86SumProc pSum=0x%x what=INIT\n", pSum)); + + nbaxes = 3; /* X, Y, pressure */ + nbbuttons = (priv->flags & STYLUS_FLAG) ? 2 : 4; + + for (loop = 1; loop <= nbbuttons; loop++) + map[loop] = loop; + + if (InitButtonClassDeviceStruct(pSum, nbbuttons, map) == FALSE) { + ErrorF("unable to allocate Button class device\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(pSum) == FALSE) { + ErrorF("unable to init Focus class device\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(pSum, xf86SumControlProc) == + FALSE) { + ErrorF("unable to init ptr feedback\n"); + return !Success; + } + + if (InitProximityClassDeviceStruct(pSum) == FALSE) { + ErrorF("unable to init proximity class device\n"); + return !Success; + } + + if (InitValuatorClassDeviceStruct(pSum, + nbaxes, + xf86GetMotionEvents, + local->history_size, + (priv->flags & ABSOLUTE_FLAG) ? + Absolute : Relative) == FALSE) { + ErrorF("unable to allocate Valuator class device\n"); + return !Success; + } +/* allocate the motion history buffer if needed */ + xf86MotionHistoryAllocate(local); +#ifndef XFREE86_V4 + AssignTypeAndName(pSum, local->atom, local->name); +#endif + +/* open the device to gather informations */ + xf86SumOpenDevice(pSum); + break; + + case DEVICE_ON: + DBG(1, ErrorF("xf86SumProc pSum=0x%x what=ON\n", pSum)); + + if ((local->fd < 0) && (!xf86SumOpenDevice(pSum))) { + return !Success; + } + SYSCALL(write(local->fd, SS_PROMPT, strlen(SS_PROMPT))); +#ifdef XFREE86_V4 + xf86AddEnabledDevice(local); +#else + AddEnabledDevice(local->fd); +#endif + pSum->public.on = TRUE; + break; + + case DEVICE_OFF: + DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + if (local->fd >= 0) +#ifdef XFREE86_V4 + xf86RemoveEnabledDevice(local); +#else + RemoveEnabledDevice(local->fd); +#endif + pSum->public.on = FALSE; + break; + + case DEVICE_CLOSE: + DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + SYSCALL(close(local->fd)); + local->fd = -1; + break; + + default: + ErrorF("unsupported mode=%d\n", what); + return !Success; + break; + } + DBG(2, ErrorF("END xf86SumProc Success what=%d dev=0x%x priv=0x%x\n", + what, pSum, priv)); + return Success; +} + +/* +** xf86SumClose +** It... Uh... Closes the physical device? +*/ +static void xf86SumClose(LocalDevicePtr local) +{ + if (local->fd >= 0) { + SYSCALL(close(local->fd)); + } + local->fd = -1; +} + +/* +** xf86SumChangeControl +** When I figure out what it does, it will do it. +*/ +static int xf86SumChangeControl(LocalDevicePtr local, xDeviceCtl * control) +{ + xDeviceResolutionCtl *res; + + res = (xDeviceResolutionCtl *) control; + + if ((control->control != DEVICE_RESOLUTION) + || (res->num_valuators < 1)) return (BadMatch); + + return (Success); +} + +/* +** xf86SumSwitchMode +** Switches the mode. For now just absolute or relative, hopefully +** more on the way. +*/ +static int xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) (local->private); + char newmode; + + DBG(3, ErrorF("xf86SumSwitchMode dev=0x%x mode=%d\n", dev, mode)); + + switch (mode) { + case Absolute: + priv->flags |= ABSOLUTE_FLAG; + newmode = SS_ABSOLUTE; + break; + + case Relative: + priv->flags &= ~ABSOLUTE_FLAG; + newmode = SS_RELATIVE; + break; + + default: + DBG(1, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n", + dev, mode)); + return BadMatch; + } + SYSCALL(write(local->fd, &newmode, 1)); + return Success; +} + +/* +** xf86SumAllocate +** Allocates the device structures for the DigitalEdge. +*/ +static LocalDevicePtr xf86SumAllocate() +{ +#ifdef XFREE86_V4 + LocalDevicePtr local = xf86AllocateInput(dedgeDrv, 0); +#else + LocalDevicePtr local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); +#endif + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) xalloc(sizeof(DigitalEdgeDeviceRec)); +#if defined (sun) && !defined(i386) + char *dev_name = getenv("DEDGESKETCH_DEV"); +#endif + + local->name = XI_NAME; + local->type_name = "DigitalEdge Tablet"; + local->flags = 0; /*XI86_NO_OPEN_ON_INIT; */ +#ifndef XFREE86_V4 +#if !defined(sun) || defined(i386) + local->device_config = xf86SumConfig; +#endif +#endif + local->device_control = xf86SumProc; + local->read_input = xf86SumReadInput; + local->control_proc = xf86SumChangeControl; + local->close_proc = xf86SumClose; + local->switch_mode = xf86SumSwitchMode; + local->conversion_proc = xf86SumConvert; + local->reverse_conversion_proc = xf86SumReverseConvert; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->private_flags = 0; + local->history_size = 0; + +#if defined(sun) && !defined(i386) + if (def_name) { + priv->dedgeDevice = (char *) xalloc(strlen(dev_name) + 1); + strcpy(priv->dedgeDevice, device_name); + ErrorF("xf86SumOpen port changed to '%s'\n", priv->dedgeDevice); + } else { + priv->dedgeDevice = ""; + } +#else + priv->dedgeDevice = ""; /* device file name */ +#endif + priv->dedgeInc = -1; /* re-transmit position on increment */ + priv->dedgeOldX = -1; /* previous X position */ + priv->dedgeOldY = -1; /* previous Y position */ + priv->dedgeOldProximity = 0; /* previous proximity */ + priv->dedgeOldPush = 0; /* previous buttons state */ + priv->dedgeOldBarrel = 0; /* previous buttons state */ + priv->dedgeMaxX = -1; /* max X value */ + priv->dedgeMaxY = -1; /* max Y value */ + priv->dedgeXSize = -1; /* active area X */ + priv->dedgeXOffset = -1; /* active area X offset */ + priv->dedgeYSize = -1; /* active area Y */ + priv->dedgeYOffset = -1; /* active area U offset */ + priv->flags = 0; /* various flags */ + priv->dedgeIndex = 0; /* number of bytes read */ + + return local; +} + +#ifndef XFREE86_V4 + +/* +** DigitalEdge device association +** Device section name and allocation function. +*/ +DeviceAssocRec dedgemasketch_assoc = { + DEDGE_SECTION_NAME, /* config_section_name */ + xf86SumAllocate /* device_allocate */ +}; + +#ifdef DYNAMIC_MODULE +/* +** init_module +** Entry point for dynamic module. +*/ +int +#ifndef DLSYM_BUG +init_module(unsigned long server_version) +#else +init_xf86DigitalEdge(unsigned long server_version) +#endif +{ + xf86AddDeviceAssoc(&dedgemasketch_assoc); + + if (server_version != XF86_VERSION_CURRENT) { + ErrorF("Warning: DigitalEdgeKetch module compiled for version%s\n", + XF86_VERSION); + return 0; + } else { + return 1; + } +} +#endif + +#else + +/* + * xf86SumUninit -- + * + * called when the driver is unloaded. + */ +static void +xf86SumUninit(InputDriverPtr drv, + LocalDevicePtr local, + int flags) +{ + DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; + + DBG(1, ErrorF("xf86DedgeUninit\n")); + + xf86SumProc(local->dev, DEVICE_OFF); + + xfree (priv); + xf86DeleteInput(local, 0); +} + + +/* + * xf86SumInit -- + * + * called when the module subsection is found in XF86Config + */ +static InputInfoPtr +xf86SumInit(InputDriverPtr drv, + IDevPtr dev, + int flags) +{ + LocalDevicePtr local = NULL; + DigitalEdgeDevicePtr priv = NULL; + char *s; + + dedgeDrv = drv; + + local = xf86SumAllocate(); + local->conf_idev = dev; + + xf86CollectInputOptions(local, default_options, NULL); + xf86OptionListReport( local->options ); + + if (local) + priv = (DigitalEdgeDevicePtr) local->private; + + if (!local || !priv) { + goto SetupProc_fail; + } + + local->name = dev->identifier; + + /* Serial Device is mandatory */ + priv->dedgeDevice = xf86FindOptionValue(local->options, "Device"); + + if (!priv->dedgeDevice) { + xf86Msg (X_ERROR, "%s: No Device specified.\n", dev->identifier); + goto SetupProc_fail; + } + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + /* Optional configuration */ + + xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, + priv->dedgeDevice); + + debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + if (debug_level > 0) { + xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level); + } + + + + s = xf86FindOptionValue(local->options, "Mode"); + + if (s && (xf86NameCmp(s, "absolute") == 0)) { + priv->flags = priv->flags | ABSOLUTE_FLAG; + } + else if (s && (xf86NameCmp(s, "relative") == 0)) { + priv->flags = priv->flags & ~ABSOLUTE_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name, + (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + + + s = xf86FindOptionValue(local->options, "Cursor"); + + if (s && (xf86NameCmp(s, "stylus") == 0)) { + priv->flags = priv->flags | STYLUS_FLAG; + } + else if (s && (xf86NameCmp(s, "puck") == 0)) { + priv->flags = priv->flags & ~STYLUS_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name, + (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); + + priv->dedgeInc = xf86SetIntOption(local->options, "increment", 0); + if (priv->dedgeInc != 0) { + xf86Msg(X_CONFIG, "%s: Increment = %d\n", + dev->identifier, priv->dedgeInc); + } + + priv->dedgeClickThresh = xf86SetIntOption(local->options, + "clickthreshold", 0); + if (priv->dedgeClickThresh != 0) { + xf86Msg(X_CONFIG, "%s: click threshold is %d\n", + dev->identifier, priv->dedgeClickThresh); + } + + priv->dedgeXSize = xf86SetIntOption(local->options, "XSize", 0); + if (priv->dedgeXSize != 0) { + xf86Msg(X_CONFIG, "%s: XSize = %d\n", + dev->identifier, priv->dedgeXSize); + } + + priv->dedgeYSize = xf86SetIntOption(local->options, "YSize", 0); + if (priv->dedgeYSize != 0) { + xf86Msg(X_CONFIG, "%s: YSize = %d\n", + dev->identifier, priv->dedgeYSize); + } + + priv->dedgeXOffset = xf86SetIntOption(local->options, "XOffset", 0); + if (priv->dedgeXOffset != 0) { + xf86Msg(X_CONFIG, "%s: XOffset = %d\n", + dev->identifier, priv->dedgeXOffset); + } + + priv->dedgeYOffset = xf86SetIntOption(local->options, "YOffset", 0); + if (priv->dedgeYOffset != 0) { + xf86Msg(X_CONFIG, "%s: YOffset = %d\n", + dev->identifier, priv->dedgeYOffset); + } + + + + /* mark the device configured */ + local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; + + /* return the LocalDevice */ + return local; + + SetupProc_fail: + if (priv) + xfree(priv); + return local; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec DIGITALEDGE = { + 1, /* driver version */ + "digitaledge", /* driver name */ + NULL, /* identify */ + xf86SumInit, /* pre-init */ + xf86SumUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + + +/* + *************************************************************************** + * + * Dynamic loading functions + * + *************************************************************************** + */ +#ifdef XFree86LOADER +/* + * xf86SumUnplug -- + * + * called when the module subsection is found in XF86Config + */ +static void +xf86SumUnplug(pointer p) +{ + DBG(1, ErrorF("xf86SumUnplug\n")); +} + +/* + * xf86SumPlug -- + * + * called when the module subsection is found in XF86Config + */ +static pointer +xf86SumPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) +{ + DBG(1, ErrorF("xf86SumPlug\n")); + + xf86AddInputDriver(&DIGITALEDGE, module, 0); + + return module; +} + +static XF86ModuleVersionInfo xf86SumVersionRec = +{ + "digitaledge", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ +}; + +XF86ModuleData digitaledgeModuleData = {&xf86SumVersionRec, + xf86SumPlug, + xf86SumUnplug}; + +#endif /* XFree86LOADER */ +#endif /* XFREE86_V4 */ + +/* end of xf86DigitalEdge.c */ diff --git a/xc/programs/Xserver/hw/xfree86/input/digitaledge/Imakefile b/xc/programs/Xserver/hw/xfree86/input/digitaledge/Imakefile new file mode 100644 index 000000000..ab9bb5edd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/digitaledge/Imakefile @@ -0,0 +1,26 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/Imakefile,v 1.1 2000/08/11 19:10:42 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = DigitalEdge.c +OBJS = DigitalEdge.o + +DRIVER = digitaledge + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) diff --git a/xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c b/xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c index 818f56861..cfcf9e4d1 100644 --- a/xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c +++ b/xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c @@ -27,7 +27,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c,v 1.2 1999/08/22 05:57:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c,v 1.3 2000/08/11 19:10:43 dawes Exp $ */ #define _DYNAPRO_C_ @@ -166,12 +166,14 @@ DynaproPreInit(InputDriverPtr drv, IDevPtr dev, int flags) DynaproPrivatePtr priv = xcalloc (1, sizeof (DynaproPrivateRec)); char *s; - if (!(pInfo = xf86AllocateInput(drv, 0))) + if (!priv) return NULL; - - if ((!drv) || (!priv)) - goto SetupProc_fail; + if (!(pInfo = xf86AllocateInput(drv, 0))) { + xfree(priv); + return NULL; + } + priv->min_x = 1000; priv->max_x = 0; priv->min_y = 0; @@ -249,14 +251,12 @@ DynaproPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86CloseSerial (pInfo->fd); if ((pInfo) && (pInfo->name)) xfree (pInfo->name); - if (pInfo) - xfree (pInfo); if ((priv) && (priv->buffer)) XisbFree (priv->buffer); if (priv) xfree (priv); - return (NULL); + return (pInfo); } static Bool diff --git a/xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c b/xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c index b91bd8459..3405a18be 100644 --- a/xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c +++ b/xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c @@ -48,7 +48,7 @@ * PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c,v 1.9 1999/06/05 15:55:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c,v 1.10 2000/08/11 19:10:44 dawes Exp $ */ #define _elo_C_ /***************************************************************************** @@ -211,14 +211,12 @@ SetupProc( pointer module, xf86CloseSerial (local->fd); if ((local) && (local->name)) xfree (local->name); - if (local) - xfree (local); if ((priv) && (priv->buffer)) XisbFree (priv->buffer); if (priv) xfree (priv); - return (NULL); + return (local); } static Bool diff --git a/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c b/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c index f4f5c4ca5..4c47793c2 100644 --- a/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c +++ b/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.10 2000/06/07 22:03:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.11 2000/08/11 19:10:45 dawes Exp $ */ /* ******************************************************************************* @@ -1494,23 +1494,21 @@ xf86EloAllocate(void) xf86EloAllocate(InputDriverPtr drv) #endif { + LocalDevicePtr local; + EloPrivatePtr priv; + + priv = xalloc(sizeof(EloPrivateRec)); + if (!priv) + return NULL; + #ifndef XFREE86_V4 - LocalDevicePtr local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); + local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); #else - LocalDevicePtr local = xf86AllocateInput(drv, 0); + local = xf86AllocateInput(drv, 0); #endif - EloPrivatePtr priv = (EloPrivatePtr) xalloc(sizeof(EloPrivateRec)); if (!local) { - if (priv) { - xfree(priv); - } - return NULL; - } - if (!priv) { - if (local) { - xfree(local); - } + xfree(priv); return NULL; } @@ -1661,8 +1659,7 @@ xf86EloInit(InputDriverPtr drv, } xfree(priv); } - xfree(local); - return NULL; + return local; } priv->input_dev = strdup(str); diff --git a/xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c b/xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c index 18d6a337c..e17ca9992 100644 --- a/xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c +++ b/xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c @@ -48,7 +48,7 @@ * PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c,v 1.11 1999/08/28 10:43:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.c,v 1.12 2000/08/11 19:10:45 dawes Exp $ */ #define _microtouch_C_ /***************************************************************************** @@ -209,13 +209,20 @@ static const char *fallback_options[] = static InputInfoPtr MuTouchPreInit(InputDriverPtr drv, IDevPtr dev, int flags) { - LocalDevicePtr local = xf86AllocateInput(drv, 0); - MuTPrivatePtr priv = xcalloc (1, sizeof (MuTPrivateRec)); + LocalDevicePtr local; + MuTPrivatePtr priv; char *s; - if ((!local) || (!priv)) - goto SetupProc_fail; + priv = xcalloc (1, sizeof (MuTPrivateRec)); + if (!priv) + return NULL; + + local = xf86AllocateInput(drv, 0); + if (!local) { + xfree(priv); + return NULL; + } local->type_name = XI_TOUCHSCREEN; local->device_control = DeviceControl; @@ -298,14 +305,12 @@ MuTouchPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86CloseSerial (local->fd); if ((local) && (local->name)) xfree (local->name); - if (local) - xfree (local); if ((priv) && (priv->buffer)) XisbFree (priv->buffer); if (priv) xfree (priv); - return (NULL); + return (local); } static Bool diff --git a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c index 6e9d3369c..4de9fc077 100644 --- a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c +++ b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.33 2000/06/28 07:51:50 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.35 2000/08/08 08:58:08 eich Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -40,8 +40,6 @@ #include "X.h" #include "Xproto.h" -#include "compiler.h" - #include "xf86.h" #ifdef XINPUT @@ -58,6 +56,8 @@ #include "xf86OSmouse.h" #define NEED_XF86_TYPES /* for xisb.h when !XFree86LOADER */ #include "xf86_ansic.h" +#include "compiler.h" + #include "xisb.h" #include "mouse.h" #include "mousePriv.h" @@ -496,6 +496,7 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) pMse->protocol = protocol; pMse->protocolID = protocolID; + pMse->oldProtocolID = protocolID; /* hack */ pMse->class = ProtocolIDToClass(protocolID); /* Collect the options, and process the common options. */ @@ -529,7 +530,11 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86Msg(X_CONFIG, "%s: SampleRate: %d\n", pInfo->name, pMse->sampleRate); } - + pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0); + if (pMse->baudRate) { + xf86Msg(X_CONFIG, "%s: BaudRate: %d\n", pInfo->name, + pMse->baudRate); + } pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0); if (pMse->resolution) { xf86Msg(X_CONFIG, "%s: Resolution: %d\n", pInfo->name, @@ -706,9 +711,31 @@ SetupMouse(InputInfoPtr pInfo) return FALSE; } } - + /* + * If protocol has changed fetch the default options + * for the new protocol. + */ + if (pMse->oldProtocolID != pMse->protocolID) { + pointer tmp = NULL; + if (mouseProtocols[pMse->protocolID].defaults) + tmp = xf86OptionListCreate( + mouseProtocols[pMse->protocolID].defaults, -1, 0); + pInfo->options = xf86OptionListMerge(pInfo->options, tmp); + /* baudrate is not explicitely set: fetch the default one */ + if (!pMse->baudRate) + pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0); + pMse->oldProtocolID = pMse->protocolID; /* hack */ + } + /* + * Write the baudrate back th the option list so that the serial + * interface code can access the new value. + */ + if (pMse->baudRate) + xf86ReplaceIntOption(pInfo->options, "BaudRate", pMse->baudRate); + /* Set the port parameters. */ - xf86SetSerial(pInfo->fd, pInfo->options); + if (!automatic) + xf86SetSerial(pInfo->fd, pInfo->options); param = NULL; paramlen = 0; switch (pMse->protocolID) { @@ -717,7 +744,7 @@ SetupMouse(InputInfoPtr pInfo) * The baud rate selection command must be sent at the current * baud rate; try all likely settings. */ - speed = xf86SetIntOption(pInfo->options, "BaudRate", 0); + speed = pMse->baudRate; switch (speed) { case 9600: s = "*q"; @@ -772,7 +799,7 @@ SetupMouse(InputInfoPtr pInfo) break; case PROT_LOGIMAN: - speed = xf86SetIntOption(pInfo->options, "BaudRate", 0); + speed = pMse->baudRate; switch (speed) { case 9600: s = "*q"; @@ -1012,12 +1039,6 @@ MouseReadInput(InputInfoPtr pInfo) */ XisbBlockDuration(pMse->buffer, -1); -#ifdef EXTMOUSEDEBUG2 - ErrorF("received %d bytes",nBytes); - for ( i=0; i < nBytes; i++) - ErrorF(" %02x",pMse->buffer[i]); - ErrorF("\n"); -#endif while ((c = XisbRead(pMse->buffer)) >= 0) { u = (unsigned char)c; if (pBufP >= pMse->protoPara[4]) { @@ -1113,6 +1134,15 @@ MouseReadInput(InputInfoPtr pInfo) */ pBuf[pBufP++] = u; if (pBufP != pMse->protoPara[4]) continue; +#ifdef EXTMOUSEDEBUG2 + { + int i; + ErrorF("received %d bytes",pBufP); + for ( i=0; i < pBufP; i++) + ErrorF(" %02x",pBuf[i]); + ErrorF("\n"); + } +#endif /* * Hack for resyncing: We check here for a package that is: diff --git a/xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile b/xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile new file mode 100644 index 000000000..100dd0450 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile @@ -0,0 +1,31 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile,v 1.1 2000/08/01 18:59:58 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86PM.c +OBJS = xf86PM.o + +DRIVER = penmount + +INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +CppManTarget($(DRIVER),) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) diff --git a/xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp b/xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp new file mode 100644 index 000000000..8fe1ddd7e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp @@ -0,0 +1,37 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp,v 1.1 2000/08/01 18:59:58 dawes Exp $ +.TH PENNMOUNT __drivermansuffix__ "Version 4.0.1" "XFree86" +.SH NAME +penmount \- PenMount input driver +.SH SYNOPSIS +.B "Section ""InputDevice""" +.br +.BI " Identifier """ idevname """" +.br +.B " Driver ""penmount""" +.br +.BI " Option ""Device"" """ devpath """" +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B penmount +is an XFree86 input driver for PenMount devices... +.PP +The +.B penmount +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1). +.SH AUTHORS +Authors include... diff --git a/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c b/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c new file mode 100644 index 000000000..296ed30a5 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c @@ -0,0 +1,760 @@ +/* + * Copyright (c) 1999 Machine Vision Holdings Incorporated + * Author: David Woodhouse <David.Woodhouse@mvhi.com> + * CoAuthor: Mayk Langer <langer@vsys.de> + * + * Template driver used: Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, cpy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c,v 1.2 2000/08/11 19:10:46 dawes Exp $ */ + +#define _PENMOUNT_C_ + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#include <xf86_ansic.h> +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <xisb.h> +#include <exevents.h> + +#include "xf86PM.h" + +InputDriverRec PENMOUNT = { + 1, + "penmount", + NULL, + PenMountPreInit, + /*PenMountUnInit*/NULL, + NULL, + 0 +}; + + + +#ifdef XFree86LOADER + +static XF86ModuleVersionInfo VersionRec = +{ + "penmount", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by + * a tool */ +}; + + +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", /* first one */ + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86CloseSerial", /* second one ? */ + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86RemoveLocalDevice", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL +}; + + +static pointer +PenMountSetupProc( pointer module, + pointer options, + int *errmaj, + int *errmin ) +{ + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&PENMOUNT, module, 0); + return (pointer) 1; +} + +XF86ModuleData penmountModuleData = { &VersionRec, PenMountSetupProc, NULL }; + + +#endif /* XFree86LOADER */ + + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ +static const char *default_options[] = +{ + /* "Device", "/dev/ttyS1",*/ + "BaudRate", "19200", + "StopBits", "1", + "DataBits", "8", + "Parity", "None", + "Vmin", "3", + "Vtime", "1", + "FlowControl", "None", + NULL, +}; + + +/***************************************************************************** + * Function Definitions + ****************************************************************************/ + + + +static InputInfoPtr +PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + PenMountPrivatePtr priv = xcalloc (1, sizeof (PenMountPrivateRec)); + char *s; + + if (!priv) + return NULL; + + if (!(pInfo = xf86AllocateInput(drv, 0))) { + xfree(priv); + return NULL; + } + + priv->min_x = 0; + priv->max_x = 1024; + priv->min_y = 768; + priv->max_y = 0; + priv->screen_num = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->lex_mode = PenMount_byte0; + priv->swap_xy = 0; + priv->button_down = FALSE; + priv->button_number = 1; + priv->proximity = FALSE; + priv->chip = CHIP_UNKNOWN; + priv->pen_down = 0; + + pInfo->type_name = XI_TOUCHSCREEN; + pInfo->device_control = DeviceControl; + pInfo->read_input = ReadInput; + pInfo->control_proc = ControlProc; + pInfo->close_proc = CloseProc; + pInfo->switch_mode = SwitchMode; + pInfo->conversion_proc = ConvertProc; + pInfo->dev = NULL; + pInfo->private = priv; + pInfo->private_flags = 0; + pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; + pInfo->conf_idev = dev; + + xf86CollectInputOptions(pInfo, default_options, NULL); + + xf86OptionListReport( pInfo->options ); + + pInfo->fd = xf86OpenSerial (pInfo->options); + if (pInfo->fd == -1) + { + ErrorF ("PenMount driver unable to open device\n"); + goto SetupProc_fail; + } + xf86CloseSerial(pInfo->fd); + /* + * Process the options for your device like this + */ + priv->min_x = xf86SetIntOption( pInfo->options, "MinX", 0 ); + priv->max_x = xf86SetIntOption( pInfo->options, "MaxX", 1024 ); + priv->min_y = xf86SetIntOption( pInfo->options, "MinY", 768 ); + priv->max_y = xf86SetIntOption( pInfo->options, "MaxY", 0 ); + priv->screen_num = xf86SetIntOption( pInfo->options, "ScreenNumber", 0 ); + priv->button_number = xf86SetIntOption( pInfo->options, "ButtonNumber", 1 ); + priv->swap_xy = xf86SetIntOption( pInfo->options, "SwapXY", 0 ); + priv->buffer = NULL; + s = xf86FindOptionValue (pInfo->options, "ReportingMode"); + if ((s) && (xf86NameCmp (s, "raw") == 0)) + priv->reporting_mode = TS_Raw; + else + priv->reporting_mode = TS_Scaled; + + priv->proximity = FALSE; + priv->button_down = FALSE; + priv->lex_mode = PenMount_byte0; + + if (QueryHardware (priv) != Success) + { + ErrorF ("Unable to query/initialize PenMount hardware.\n"); + goto SetupProc_fail; + } + + /* this results in an xstrdup that must be freed later */ + pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "PenMount"); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + pInfo->flags |= XI86_CONFIGURED; + return (pInfo); + + SetupProc_fail: + if ((pInfo) && (pInfo->fd)) + xf86CloseSerial (pInfo->fd); + if ((pInfo) && (pInfo->name)) + xfree (pInfo->name); + + if ((priv) && (priv->buffer)) + XisbFree (priv->buffer); + if (priv) + xfree (priv); + return (pInfo); +} + +static Bool +DeviceControl (DeviceIntPtr dev, int mode) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + PenMountPrivatePtr priv = (PenMountPrivatePtr) (pInfo->private); + unsigned char map[] = + {0, 1}; + + switch (mode) + { + case DEVICE_INIT: + /* + * these have to be here instead of in the SetupProc, because when the + * SetupProc is run at server startup, screenInfo is not setup yet + */ + priv->screen_width = screenInfo.screens[priv->screen_num]->width; + priv->screen_height = screenInfo.screens[priv->screen_num]->height; + + /* + * Device reports button press for 1 button. + */ + if (InitButtonClassDeviceStruct (dev, 1, map) == FALSE) + { + ErrorF ("Unable to allocate PenMount ButtonClassDeviceStruct\n"); + return !Success; + } + + /* + * Device reports motions on 2 axes in absolute coordinates. + * Axes min and max values are reported in raw coordinates. + */ + if (InitValuatorClassDeviceStruct (dev, 2, xf86GetMotionEvents, + pInfo->history_size, Absolute) == FALSE) + { + ErrorF ("Unable to allocate PenMount ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x, + 9500, + 0 /* min_res */ , + 9500 /* max_res */ ); + InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y, + 10500, + 0 /* min_res */ , + 10500 /* max_res */ ); + } + + if (InitProximityClassDeviceStruct (dev) == FALSE) + { + ErrorF ("unable to allocate PenMount ProximityClassDeviceStruct\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(dev, PenMountPtrCtrl) == FALSE) + { + ErrorF ("unable to allocate PenMount PtrFeedbackClassDeviceStruct\n"); + return !Success; + } + + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate (pInfo); + return (Success); + + case DEVICE_ON: + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) + { + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + return (!Success); + } + else + { + priv->buffer = XisbNew(pInfo->fd, 64); + if (!priv->buffer) + { + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + return (!Success); + } +/* if (isatty (pInfo->fd)) check if DMC8910 is found */ + { +/* echo Success Code */ + unsigned char buf[5] = { 'D', 'G', 0x02, 0x80, 0x00 }; + + XisbBlockDuration (priv->buffer, 500000); + if ( PenMountSendPacket(priv, buf, 5) == Success ) + { + /* wait for right response */ + priv->lex_mode = PenMount_Response0; + if (PenMountGetPacket (priv) == Success ) + { + if (( priv->packet[0] == 0xff ) && + ( priv->packet[1] == 0x70 ) ) + { + priv->chip = DMC8910; + /* disable DMC8910 */ + buf[2] = 0x0b; + buf[3] = 0x00; + buf[4] = 0x00; + PenMountSendPacket(priv,buf,5); + priv->lex_mode = PenMount_Response0; + PenMountGetPacket(priv); + /* set screen width */ + buf[2] = 0x02; + buf[3] = (priv->screen_width & 0x0fff) >> 8; + buf[4] = priv->screen_width & 0xff; + PenMountSendPacket(priv,buf,5); + priv->lex_mode = PenMount_Response0; + PenMountGetPacket(priv); + /* set screen height */ + buf[2] = 0x02; + buf[3] = (priv->screen_height & 0x0fff) >> 8; + buf[4] = priv->screen_height & 0xff; + buf[3] |= 0x10; + PenMountSendPacket(priv,buf,5); + priv->lex_mode = PenMount_Response0; + PenMountGetPacket(priv); + /* enable DMC8910 */ + buf[2] = 0x0a; + buf[3] = 0x01; + buf[4] = 0x00; + PenMountSendPacket(priv,buf,5); + priv->lex_mode = PenMount_Response0; + PenMountGetPacket(priv); + } + } + } + } + } + + XisbBlockDuration (priv->buffer, -1); + priv->lex_mode = PenMount_byte0; + + xf86FlushInput(pInfo->fd); + AddEnabledDevice (pInfo->fd); + dev->public.on = TRUE; + return (Success); + + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pInfo->fd != -1) + { + RemoveEnabledDevice (pInfo->fd); + if (priv->buffer) + { + XisbFree(priv->buffer); + priv->buffer = NULL; + } + xf86CloseSerial(pInfo->fd); + } + dev->public.on = FALSE; + return (Success); + default: + return (BadValue); + } + +} + + +/* + * The ReadInput function will have to be tailored to your device + */ +static void +ReadInput (InputInfoPtr pInfo) +{ + PenMountPrivatePtr priv = (PenMountPrivatePtr) (pInfo->private); + int x,y; + unsigned char opck[ PENMOUNT_PACKET_SIZE ]; + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded buy a select with a 0 timeout to prevent + * read from blocking indefinately. + */ + XisbBlockDuration (priv->buffer, -1); + while (1) + { + if ( priv->chip != DMC8910 ) + { + if ( PenMountGetPacket (priv) != Success) + break; + if (( priv->packet[0] & 0x0C ) != 0x0C ) + break; + if (priv->swap_xy) { + y = priv->packet[1]; + y |= (priv->packet[0] & 0x10) ? 0x100 : 0; + y |= (priv->packet[0] & 0x40) ? 0x200 : 0; + x = priv->packet[2]; + x |= (priv->packet[0] & 0x20) ? 0x100 : 0; + x |= (priv->packet[0] & 0x80) ? 0x200 : 0; + } else { + x = priv->packet[1]; + x |= (priv->packet[0] & 0x10) ? 0x100 : 0; + x |= (priv->packet[0] & 0x40) ? 0x200 : 0; + y = priv->packet[2]; + y |= (priv->packet[0] & 0x20) ? 0x100 : 0; + y |= (priv->packet[0] & 0x80) ? 0x200 : 0; + } + } + else + { + memcpy(opck,priv->packet,5); + if ( PenMountGetPacket (priv) != Success ) + break; + if (( priv->packet[1] == 0xfd ) && ( priv->packet[2] == 0xfd )) + { + priv->pen_down = 1; + continue; + } + if (( priv->packet[1] == 0xfe ) && ( priv->packet[2] == 0xfe )) + { + memcpy(priv->packet,opck,5); + if ( !priv->pen_down ) + continue; + priv->pen_down = 0; + } + if ( priv->swap_xy) + { + y = priv->packet[1]*256+priv->packet[2]; + x = priv->packet[3]*256+priv->packet[4]; + } + else + { + x = priv->packet[1]*256+priv->packet[2]; + y = priv->packet[3]*256+priv->packet[4]; + } + priv->packet[0] = priv->pen_down ? 0x01 : 0x00; + } + + if (priv->reporting_mode == TS_Scaled) + { + x = xf86ScaleAxis (x, 0, priv->screen_width, priv->min_x, + priv->max_x); + y = xf86ScaleAxis (y, 0, priv->screen_height, priv->min_y, + priv->max_y); + } + + xf86XInputSetScreen (pInfo, priv->screen_num, x, y); + + if ((priv->proximity == FALSE) && (priv->packet[0] & 0x01)) + { + priv->proximity = TRUE; + xf86PostProximityEvent (pInfo->dev, 1, 0, 2, x, y); + } + + /* + * Send events. + * + * We *must* generate a motion before a button change if pointer + * location has changed as DIX assumes this. This is why we always + * emit a motion, regardless of the kind of packet processed. + */ + + xf86PostMotionEvent (pInfo->dev, TRUE, 0, 2, x, y); + + /* + * Emit a button press or release. + */ + if ((priv->button_down == FALSE) && (priv->packet[0] & 0x01)) + + { + xf86PostButtonEvent (pInfo->dev, TRUE, + priv->button_number, 1, 0, 2, x, y); + priv->button_down = TRUE; + } + if ((priv->button_down == TRUE) && !(priv->packet[0] & 0x01)) + { + xf86PostButtonEvent (pInfo->dev, TRUE, + priv->button_number, 0, 0, 2, x, y); + priv->button_down = FALSE; + } + /* + * the untouch should always come after the button release + */ + if ((priv->proximity == TRUE) && !(priv->packet[0] & 0x01)) + { + priv->proximity = FALSE; + xf86PostProximityEvent (pInfo->dev, 0, 0, 2, x, y); + } + } +} + +/* + * The ControlProc function may need to be tailored for your device + */ +static int +ControlProc (InputInfoPtr pInfo, xDeviceCtl * control) +{ + xDeviceTSCalibrationCtl *c = (xDeviceTSCalibrationCtl *) control; + PenMountPrivatePtr priv = (PenMountPrivatePtr) (pInfo->private); + + priv->min_x = c->min_x; + priv->max_x = c->max_x; + priv->min_y = c->min_y; + priv->max_y = c->max_y; + + return (Success); +} + +/* + * the CloseProc should not need to be tailored to your device + */ +static void +CloseProc (InputInfoPtr pInfo) +{ + +} + +/* + * The SwitchMode function may need to be tailored for your device + */ +static int +SwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + PenMountPrivatePtr priv = (PenMountPrivatePtr) (pInfo->private); + + + if ((mode == TS_Raw) || (mode == TS_Scaled)) + { + priv->reporting_mode = mode; + return (Success); + } + else if ((mode == SendCoreEvents) || (mode == DontSendCoreEvents)) + { + xf86XInputSetSendCoreEvents (pInfo, (mode == SendCoreEvents)); + return (Success); + } + else + return (!Success); +} + +/* + * The ConvertProc function may need to be tailored for your device. + * This function converts the device's valuator outputs to x and y coordinates + * to simulate mouse events. + */ +static Bool +ConvertProc (InputInfoPtr pInfo, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) +{ + PenMountPrivatePtr priv = (PenMountPrivatePtr) (pInfo->private); + + if (priv->reporting_mode == TS_Raw) + { + *x = xf86ScaleAxis (v0, 0, priv->screen_width, priv->min_x, + priv->max_x); + *y = xf86ScaleAxis (v1, 0, priv->screen_height, priv->min_y, + priv->max_y); + } + else + { + *x = v0; + *y = v1; + } + return (TRUE); +} + +/* + * the QueryHardware fuction should be tailored to your device to + * verify the device is attached and functional and perform any + * needed initialization. + */ +static Bool +QueryHardware (PenMountPrivatePtr priv) +{ + /* Maybe once we get the hardware to actually respond correctly to its + configuration 'packets' */ + + return (Success); +} + +/* + * This function should be renamed for your device and tailored to handle + * your device's protocol. + */ +static Bool +PenMountGetPacket (PenMountPrivatePtr priv) +{ + int count = 0; + int c; + + while ((c = XisbRead (priv->buffer)) >= 0) + { + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) + return (!Success); + + switch (priv->lex_mode) + { + case PenMount_byte0: + if ( priv->chip != DMC8910 ) + { + if (!(c & 0x08) ) + return (!Success); + } + else + { + if ( c != 0xff ) + return (!Success); + } + priv->packet[0] = (unsigned char) c; + priv->lex_mode = PenMount_byte1; + break; + + case PenMount_byte1: + priv->packet[1] = (unsigned char) c; + priv->lex_mode = PenMount_byte2; + break; + + case PenMount_byte2: + priv->packet[2] = (unsigned char) c; + priv->lex_mode = PenMount_byte0; + if ( priv->chip != DMC8910 ) + return (Success); + if (( priv->packet[2] == 0xfe ) && ( priv->packet[1] == 0xfe )) + return (Success); + if (( priv->packet[2] == 0xfd ) && ( priv->packet[1] == 0xfd )) + return (Success); + priv->lex_mode = PenMount_byte3; + break; + + case PenMount_byte3: + priv->packet[3] = (unsigned char) c; + priv->lex_mode = PenMount_byte4; + break; + + case PenMount_byte4: + priv->packet[4] = (unsigned char) c; + priv->lex_mode = PenMount_byte0; + return (Success); + break; + + case PenMount_Response0: + if ( c == 0xff ) + priv->lex_mode = PenMount_Response1; + priv->packet[0] = (unsigned char) c; + break; + + case PenMount_Response1: + priv->packet[1] = (unsigned char) c; + priv->lex_mode = PenMount_Response2; + break; + case PenMount_Response2: + priv->packet[2] = (unsigned char) c; + priv->lex_mode = PenMount_byte0; + return (Success); + break; + } + } + return (!Success); +} + +static Bool +PenMountSendPacket (PenMountPrivatePtr priv, unsigned char *buf, int len) +{ + int count = 0; + + while ( len > 0 ) + { + if ( XisbWrite(priv->buffer, buf, 1) == 1 ) + { + buf++; + len--; + continue; + } + if ( count++ > 500 ) + break; + } + return (len ? !Success : Success); +} + +static void +PenMountPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* I have no clue what this does, except that registering it stops the + X server segfaulting in ProcGetPointerMapping() + Ho Hum. + */ +} diff --git a/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.h b/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.h new file mode 100644 index 000000000..93757d954 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1999 Machine Vision Holdings Incorporated + * Author: David Woodhouse <David.Woodhouse@mvhi.com> + * + * Template driver used: Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.h,v 1.1 2000/08/01 18:59:58 dawes Exp $ */ + +#ifndef _PENMOUNT_H_ +#define _PENMOUNT_H_ + +/****************************************************************************** + * Definitions + * structs, typedefs, #defines, enums + *****************************************************************************/ + +#define PENMOUNT_PACKET_SIZE 5 + +typedef enum +{ + PenMount_byte0, PenMount_byte1, PenMount_byte2, PenMount_byte3, PenMount_byte4, + PenMount_Response0, PenMount_Response1, PenMount_Response2 +} +PenMountState; + + +typedef struct _PenMountPrivateRec +{ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ + Bool button_down; /* is the "button" currently down */ + int button_number; /* which button to report */ + int reporting_mode; /* TS_Raw or TS_Scaled */ + + int screen_num; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + int proximity; + int swap_xy; + XISBuffer *buffer; + unsigned char packet[PENMOUNT_PACKET_SIZE]; /* packet being/just read */ + PenMountState lex_mode; + char chip; + char pen_down; +} +PenMountPrivateRec, *PenMountPrivatePtr; + +#define CHIP_UNKNOWN 0 +#define DMC8910 1 + + +/****************************************************************************** + * Declarations + *****************************************************************************/ + +static Bool DeviceControl (DeviceIntPtr, int); +static void ReadInput (InputInfoPtr); +static int ControlProc (InputInfoPtr, xDeviceCtl *); +static void CloseProc (InputInfoPtr); +static int SwitchMode (ClientPtr, DeviceIntPtr, int); +static Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *); +static Bool QueryHardware (PenMountPrivatePtr); +static Bool PenMountGetPacket (PenMountPrivatePtr priv); +static Bool PenMountSendPacket (PenMountPrivatePtr priv, unsigned char *buf, int len ); + +static InputInfoPtr +PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags); + +static void +PenMountPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl); + + +#endif /* _PENMOUNT_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c b/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c index 4e751a2aa..8f7a88ec7 100644 --- a/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c +++ b/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c @@ -24,7 +24,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c,v 1.9 1999/06/05 15:55:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c,v 1.10 2000/08/11 19:10:47 dawes Exp $ */ #define _SPACEORB_C_ /***************************************************************************** @@ -49,9 +49,23 @@ * Variables without includable headers ****************************************************************************/ + /***************************************************************************** * Local Variables ****************************************************************************/ +/** @added by Guido Heumer */ +InputDriverRec SPACEORB = { + 1, + "spaceorb", + NULL, + SpaceorbPreInit, + /*DynaproUnInit*/NULL, + NULL, + 0 +}; + +#ifdef XFree86LOADER + static XF86ModuleVersionInfo VersionRec = { "spaceorb", @@ -67,6 +81,67 @@ static XF86ModuleVersionInfo VersionRec = * a tool */ }; +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86CloseSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86RemoveLocalDevice", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL +}; + +static pointer +SPACEORBSetupProc(pointer module, + pointer options, + int *errmaj, + int *errmin ) { + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&SPACEORB, module, 0); + return (pointer) 1; +} + +/* was before: XF86ModuleData spaceorbModuleData = { &VersionRec, SetupProc, TearDownProc }; */ +XF86ModuleData spaceorbModuleData = { &VersionRec, SPACEORBSetupProc, TearDownProc }; + +#endif /* XFree86LOADER */ + + /* * Be sure to set vmin appropriately for your device's protocol. You want to * read a full packet before returning @@ -79,118 +154,109 @@ static const char *default_options[] = "Parity", "None", "Vmin", "5", "Vtime", "1", - "FlowControl", "None" + "FlowControl", "None", + NULL, }; static char spaceware[] = "0SpaceWare!"; -XF86ModuleData spaceorbModuleData = { &VersionRec, SetupProc, TearDownProc }; - /***************************************************************************** * Function Definitions ****************************************************************************/ +static InputInfoPtr +SpaceorbPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + SPACEORBPrivatePtr priv = xcalloc (1, sizeof (SPACEORBPrivateRec)); -static void -TearDownProc( pointer p ) -{ - LocalDevicePtr local = (LocalDevicePtr) p; - SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) local->private; - - DeviceOff (local->dev); - - xf86RemoveLocalDevice (local); - - xf86CloseSerial (local->fd); - XisbFree (priv->buffer); - xfree (priv); - xfree (local->name); - xfree (local); -} - -static pointer -SetupProc( pointer module, - pointer options, - int *errmaj, - int *errmin ) -{ - LocalDevicePtr local = - xcalloc (1, sizeof (LocalDeviceRec)); - SPACEORBPrivatePtr priv = - xcalloc (1, sizeof (SPACEORBPrivateRec)); - pointer defaults, - merged; - - if ((!local) || (!priv)) - goto SetupProc_fail; - - defaults = xf86OptionListCreate (default_options, - (sizeof (default_options) / sizeof (default_options[0])), 0); - merged = xf86OptionListMerge (defaults, options); + if (!priv) + return NULL; - xf86OptionListReport( merged ); - - local->fd = xf86OpenSerial (merged); - if (local->fd == -1) - { - ErrorF ("SPACEORB driver unable to open device\n"); - *errmaj = LDR_NOPORTOPEN; - *errmin = xf86GetErrno (); - goto SetupProc_fail; + if (!(pInfo = xf86AllocateInput(drv, 0))) { + xfree(priv); + return NULL; } - - priv->buffer = XisbNew (local->fd, 200); - + + priv->lex_mode = SPACEORB_normal; + priv->packeti = 0; + priv->old_buttons=0; + priv->buffer= NULL; + + pInfo->type_name = XI_SPACEBALL; + pInfo->device_control = DeviceControl; + pInfo->read_input = ReadInput; + pInfo->control_proc = ControlProc; + pInfo->close_proc = CloseProc; + pInfo->switch_mode = SwitchMode; + pInfo->conversion_proc = ConvertProc; + pInfo->dev = NULL; + pInfo->private = priv; + pInfo->private_flags = 0; + pInfo->flags = 0; + pInfo->conf_idev = dev; + + xf86CollectInputOptions(pInfo, default_options, NULL); + + xf86OptionListReport( pInfo->options ); + + pInfo->fd = xf86OpenSerial (pInfo->options); + if (pInfo->fd == -1) + { + ErrorF ("SPACEORB driver unable to open device\n"); + goto SetupProc_fail; + } + + priv->buffer = XisbNew (pInfo->fd, 200); DBG (9, XisbTrace (priv->buffer, 1)); /* * Verify the hardware is attached and functional */ - if (QueryHardware (priv, errmaj, errmin) != Success) - { - ErrorF ("Unable to query/initialize SpaceOrb hardware.\n"); - goto SetupProc_fail; - } - - /* this results in an xstrdup that must be freed later */ - local->name = xf86SetStrOption( merged, "DeviceName", "SpaceOrb XInput Device" ); - - local->type_name = XI_SPACEBALL; - /* - * Standard setup for the local device record - */ - local->device_control = DeviceControl; - local->read_input = ReadInput; - local->control_proc = ControlProc; - local->close_proc = CloseProc; - local->switch_mode = SwitchMode; - local->conversion_proc = ConvertProc; - local->dev = NULL; - local->private = priv; - local->private_flags = 0; - local->history_size = xf86SetIntOption( merged, "HistorySize", 0 ); - - xf86AddLocalDevice( local, merged ); - - /* return the LocalDevice */ - return (local); + if (QueryHardware (priv) != Success) + { + ErrorF ("Unable to query/initialize SpaceOrb hardware.\n"); + goto SetupProc_fail; + } + + /* this results in an xstrdup that must be freed later */ + pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "SpaceOrb XInput Device"); + pInfo->history_size = xf86SetIntOption( pInfo->options, "HistorySize", 0 ); + + xf86ProcessCommonOptions(pInfo, pInfo->options); + + pInfo->flags |= XI86_CONFIGURED; + return (pInfo); /* * If something went wrong, cleanup and return NULL */ SetupProc_fail: - if ((local) && (local->fd)) - xf86CloseSerial (local->fd); - if ((local) && (local->name)) - xfree (local->name); - if (local) - xfree (local); - - if ((priv) && (priv->buffer)) - XisbFree (priv->buffer); + if ((pInfo) && (pInfo->fd)) + xf86CloseSerial (pInfo->fd); + if ((pInfo) && (pInfo->name)) + xfree (pInfo->name); + + if ((priv) && (priv->buffer)) + XisbFree (priv->buffer); if (priv) - xfree (priv); - return (NULL); + xfree (priv); + return (pInfo); +} + +static void +TearDownProc( pointer p ) +{ + InputInfoPtr pInfo = (InputInfoPtr) p; + SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) pInfo->private; + + DeviceOff (pInfo->dev); + + xf86CloseSerial (pInfo->fd); + XisbFree (priv->buffer); + xfree (priv); + xfree (pInfo->name); + xfree (pInfo); } static Bool @@ -223,150 +289,159 @@ DeviceControl (DeviceIntPtr dev, int mode) static Bool DeviceOn (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + InputInfoPtr pInfo = dev->public.devicePrivate; - AddEnabledDevice (local->fd); - dev->public.on = TRUE; - return (Success); + AddEnabledDevice (pInfo->fd); + dev->public.on = TRUE; + return (Success); } static Bool DeviceOff (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + InputInfoPtr pInfo = dev->public.devicePrivate; - RemoveEnabledDevice (local->fd); - dev->public.on = FALSE; - return (Success); + RemoveEnabledDevice (pInfo->fd); + dev->public.on = FALSE; + return (Success); } + static Bool DeviceClose (DeviceIntPtr dev) { - return (Success); + return (Success); } static Bool DeviceInit (DeviceIntPtr dev) { - LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; - unsigned char map[] = - {0, 1, 2, 3, 4, 5, 6, 7}; - - if (InitButtonClassDeviceStruct (dev, 7, map) == FALSE) - { - ErrorF ("Unable to allocate SPACEORB ButtonClassDeviceStruct\n"); - return !Success; - } - - if (InitFocusClassDeviceStruct (dev) == FALSE) - { - ErrorF("Unable to allocate SPACEORB FocusClassDeviceStruct\n"); - return !Success; + InputInfoPtr pInfo = dev->public.devicePrivate; + + unsigned char map[] = {0, 1, 2, 3, 4, 5, 6, 7}; + + if (InitButtonClassDeviceStruct (dev, 7, map) == FALSE) { + ErrorF ("Unable to allocate SPACEORB ButtonClassDeviceStruct\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct (dev) == FALSE) { + ErrorF("Unable to allocate SPACEORB FocusClassDeviceStruct\n"); + return !Success; + } + + if (InitValuatorClassDeviceStruct (dev, 6, xf86GetMotionEvents, + pInfo->history_size, Absolute) == FALSE) + { + ErrorF ("Unable to allocate SPACEORB ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct(dev, 0, -512, 511, 9600,0,9600); + InitValuatorAxisStruct(dev, 1, -512, 511, 9600,0,9600); + InitValuatorAxisStruct(dev, 2, -512, 511, 9600,0,9600); + InitValuatorAxisStruct(dev, 3, -512, 511, 9600,0,9600); + InitValuatorAxisStruct(dev, 4, -512, 511, 9600,0,9600); + InitValuatorAxisStruct(dev, 5, -512, 511, 9600,0,9600); } - - - if (InitValuatorClassDeviceStruct (dev, 6, xf86GetMotionEvents, - local->history_size, Absolute) == FALSE) - { - ErrorF ("Unable to allocate SPACEORB ValuatorClassDeviceStruct\n"); - return !Success; - } - else - { - InitValuatorAxisStruct(dev, 0, -512, 511, 9600,0,9600); - InitValuatorAxisStruct(dev, 1, -512, 511, 9600,0,9600); - InitValuatorAxisStruct(dev, 2, -512, 511, 9600,0,9600); - InitValuatorAxisStruct(dev, 3, -512, 511, 9600,0,9600); - InitValuatorAxisStruct(dev, 4, -512, 511, 9600,0,9600); - InitValuatorAxisStruct(dev, 5, -512, 511, 9600,0,9600); - } - - /* - * Allocate the motion events buffer. - */ - xf86MotionHistoryAllocate (local); - return (Success); + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate (pInfo); + return (Success); } +/* + * The ReadInput function will have to be tailored to your device + */ static void ReadInput (LocalDevicePtr local) { - int x, y, z, u, v, r; - int buttons; - int i; - SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) (local->private); - - /* - * set blocking to -1 on the first call because we know there is data to - * read. Xisb automatically clears it after one successful read so that - * succeeding reads are preceeded buy a select with a 0 timeout to prevent - * read from blocking indefinately. - */ - XisbBlockDuration (priv->buffer, -1); - while (SPACEORBGetPacket (priv) == Success) + int x, y, z, u, v, r; + int buttons; + int i; + SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) (local->private); + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded buy a select with a 0 timeout to prevent + * read from blocking indefinately. + */ + XisbBlockDuration (priv->buffer, -1); + while (SPACEORBGetPacket (priv) == Success) + { + /* + * Examine priv->packet and call these functions as appropriate: + * + xf86PostMotionEvent + xf86PostButtonEvent + */ + switch (priv->packet_type) { - /* - * Examine priv->packet and call these functions as appropriate: - * - xf86PostMotionEvent - xf86PostButtonEvent - */ - switch (priv->packet_type) - { - case SPACEORB_D_PACKET: - /* Turn chars into 10 bit integers */ - x = ((priv->packet[1] & 0177)<<3)|((priv->packet[2] & 0160)>>4); - y = ((priv->packet[2] & 0017)<<6)|((priv->packet[3] & 0176)>>1); - z = ((priv->packet[3] & 0001)<<9)|((priv->packet[4] & 0177)<<2)|((priv->packet[5] & 0140)>>5); - u = ((priv->packet[5] & 0037)<<5)|((priv->packet[6] & 0174)>>2); - v = ((priv->packet[6] & 0003)<<8)|((priv->packet[7] & 0177)<<1)|((priv->packet[8] & 0100)>>6); - r = ((priv->packet[8] & 0077)<<4)|((priv->packet[9] & 0170)>>3); - - /* Get the sign right. */ - if (x > 511) x -= 1024; - if (y > 511) y -= 1024; - if (z > 511) z -= 1024; - if (u > 511) u -= 1024; - if (v > 511) v -= 1024; - if (r > 511) r -= 1024; - - xf86ErrorFVerb( 9, "SpaceOrb motion %d %d %d -- %d %d %d\n", - x, y, z, u, v, r ); - xf86PostMotionEvent(local->dev, TRUE, 0, 6, x, y, z, u, v, r); - break; - - case SPACEORB_K_PACKET: - buttons = priv->packet[1]; - if (priv->old_buttons != buttons) - for (i = 0; i < 7; i++) - { - if ((priv->old_buttons&(1<<i)) != (buttons&(1<<i))) - { - xf86PostButtonEvent(local->dev, FALSE, i+1, - (buttons&(1<<i)), 0, 0); - xf86ErrorFVerb( 9, "SpaceOrb setting button %d to %d\n", - i+1, (buttons&(1<<i)) ); - } - } - priv->old_buttons = buttons; - break; - } + case SPACEORB_D_PACKET: + /* Turn chars into 10 bit integers */ + x = ((priv->packet[1] & 0177)<<3)|((priv->packet[2] & 0160)>>4); + y = ((priv->packet[2] & 0017)<<6)|((priv->packet[3] & 0176)>>1); + z = ((priv->packet[3] & 0001)<<9)|((priv->packet[4] & 0177)<<2)|((priv->packet[5] & 0140)>>5); + u = ((priv->packet[5] & 0037)<<5)|((priv->packet[6] & 0174)>>2); + v = ((priv->packet[6] & 0003)<<8)|((priv->packet[7] & 0177)<<1)|((priv->packet[8] & 0100)>>6); + r = ((priv->packet[8] & 0077)<<4)|((priv->packet[9] & 0170)>>3); + + /* Get the sign right. */ + if (x > 511) x -= 1024; + if (y > 511) y -= 1024; + if (z > 511) z -= 1024; + if (u > 511) u -= 1024; + if (v > 511) v -= 1024; + if (r > 511) r -= 1024; + + xf86ErrorFVerb( 9, "SpaceOrb motion %d %d %d -- %d %d %d\n", + x, y, z, u, v, r ); + xf86PostMotionEvent(local->dev, TRUE, 0, 6, x, y, z, u, v, r); + break; + + case SPACEORB_K_PACKET: + buttons = priv->packet[1]; + if (priv->old_buttons != buttons) + for (i = 0; i < 7; i++) + { + if ((priv->old_buttons&(1<<i)) != (buttons&(1<<i))) + { + xf86PostButtonEvent(local->dev, FALSE, i+1, + (buttons&(1<<i)), 0, 0); + xf86ErrorFVerb( 9, "SpaceOrb setting button %d to %d\n", + i+1, (buttons&(1<<i)) ); + } + } + priv->old_buttons = buttons; + break; } + } } +/* + * The ControlProc function may need to be tailored for your device + */ static int ControlProc (LocalDevicePtr local, xDeviceCtl * control) { return (Success); } +/* + * the CloseProc should not need to be tailored to your device + */ static void CloseProc (LocalDevicePtr local) { } +/* + * The SwitchMode function may need to be tailored for your device + */ static int SwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) { @@ -389,36 +464,40 @@ ConvertProc (LocalDevicePtr local, int *x, int *y) { - *x = v0; - *y = v1; + *x = v3; + *y = v4; return (Success); } +/* + * the QueryHardware fuction should be tailored to your device to + * verify the device is attached and functional and perform any + * needed initialization. + */ static Bool -QueryHardware (SPACEORBPrivatePtr priv, int *errmaj, int *errmin) +QueryHardware (SPACEORBPrivatePtr priv) { - /* - * When you open the serial port, the spaceorb sends a greeting packet - * make sure we got it to verify that the device is present. - * block for up to a second to make sure the data is there. - */ - XisbBlockDuration (priv->buffer, 1000000); - if ((SPACEORBGetPacket (priv) == Success) && - (priv->packet_type == SPACEORB_R_PACKET)) - return (Success); - else - { - ErrorF ("No response from SpaceOrb hardware.\n"); - *errmaj = LDR_NOHARDWARE; - return (!Success); - } + /* + * When you open the serial port, the spaceorb sends a greeting packet + * make sure we got it to verify that the device is present. + * block for up to a second to make sure the data is there. + */ + XisbBlockDuration (priv->buffer, 1000000); + if ((SPACEORBGetPacket (priv) == Success) && + (priv->packet_type == SPACEORB_R_PACKET)) + return (Success); + else + { + ErrorF ("No response from SpaceOrb hardware.\n"); + return (!Success); + } } static void NewPacket (SPACEORBPrivatePtr priv) { - priv->lex_mode = SPACEORB_normal; - priv->packeti = 0; + priv->lex_mode = SPACEORB_normal; + priv->packeti = 0; } static Bool @@ -429,79 +508,88 @@ SPACEORBGetPacket (SPACEORBPrivatePtr priv) while ((c = XisbRead (priv->buffer)) >= 0) { - /* - * fail after 500 bytes so the server doesn't hang forever if a - * device sends bad data. - */ - if (count++ > 500) + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) + { + NewPacket (priv); + return (!Success); + } + if (c == '\r') + continue; + + switch (priv->lex_mode) + { + case SPACEORB_normal: + if (c == SPACEORB_R_PACKET) { - NewPacket (priv); - return (!Success); + xf86ErrorFVerb( 9, "SpaceOrb got an R packet\n" ); + priv->packet_type = SPACEORB_R_PACKET; + priv->lex_mode = SPACEORB_body; + priv->expected_len = SPACEORB_R_BODY_LEN; } - if (c == '\r') - continue; - - switch (priv->lex_mode) + else if (c == SPACEORB_K_PACKET) + { + priv->packet_type = SPACEORB_K_PACKET; + priv->lex_mode = SPACEORB_body; + priv->expected_len = SPACEORB_K_BODY_LEN; + } + else if (c == SPACEORB_D_PACKET) + { + xf86ErrorFVerb( 9, "SpaceOrb got a D packet\n" ); + priv->packet_type = SPACEORB_D_PACKET; + priv->lex_mode = SPACEORB_Dbody; + priv->expected_len = SPACEORB_D_BODY_LEN; + } + break; + case SPACEORB_Dbody: + if (priv->packeti < priv->expected_len) + { + xf86ErrorFVerb( 9, "\t%d = %c data = %c %d\n", + priv->packeti, spaceware[priv->packeti], + (c & 0x7F), (c & 0x7F) ); + priv->packet[priv->packeti] = + (unsigned char) (c & 0x7F) ^ spaceware[priv->packeti]; + priv->packeti++; + } + if (priv->packeti == priv->expected_len) { - case SPACEORB_normal: - if (c == SPACEORB_R_PACKET) - { - xf86ErrorFVerb( 9, "SpaceOrb got an R packet\n" ); - priv->packet_type = SPACEORB_R_PACKET; - priv->lex_mode = SPACEORB_body; - priv->expected_len = SPACEORB_R_BODY_LEN; - } - else if (c == 'K') - { - priv->packet_type = SPACEORB_K_PACKET; - priv->lex_mode = SPACEORB_body; - priv->expected_len = SPACEORB_K_BODY_LEN; - } - else if (c == 'D') - { - xf86ErrorFVerb( 9, "SpaceOrb got a D packet\n" ); - priv->packet_type = SPACEORB_D_PACKET; - priv->lex_mode = SPACEORB_Dbody; - priv->expected_len = SPACEORB_D_BODY_LEN; - } - break; - case SPACEORB_Dbody: - if (priv->packeti < priv->expected_len) - { - xf86ErrorFVerb( 9, "\t%d = %c data = %c %d\n", - priv->packeti, spaceware[priv->packeti], - (c & 0x7F), (c & 0x7F) ); - priv->packet[priv->packeti] = - (unsigned char) (c & 0x7F) ^ spaceware[priv->packeti]; - priv->packeti++; - } - if (priv->packeti == priv->expected_len) - { #ifdef DEBUG ErrorF ("returning packet <"); -{ + { int i; for (i = 0; i < priv->expected_len; i++) ErrorF ("%c", priv->packet[i]); ErrorF (">\n"); } #endif - NewPacket (priv); - return (Success); - } - break; - - case SPACEORB_body: - if (priv->packeti < priv->expected_len) - priv->packet[priv->packeti++] = (unsigned char) c & 0x7F; - if (priv->packeti == priv->expected_len) - { - NewPacket (priv); + NewPacket (priv); return (Success); } break; + case SPACEORB_body: + if (priv->packeti < priv->expected_len) + priv->packet[priv->packeti++] = (unsigned char) c & 0x7F; + if (priv->packeti == priv->expected_len) + { + NewPacket (priv); + return (Success); } + break; + + } } return (!Success); } + + + + + + + + + diff --git a/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h b/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h index c41c5bc69..acd747a17 100644 --- a/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h +++ b/xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h @@ -1,5 +1,7 @@ /* - * Copyright (c) 1998 Metro Link Incorporated + * Author: Guido Heumer <gheumer@hons.cs.usyd.edu.au> + * + * Template driver used: Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,12 +26,14 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h,v 1.2 1999/02/01 12:13:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h,v 1.3 2000/08/11 19:10:47 dawes Exp $ */ #ifndef _SPACEORB_H_ #define _SPACEORB_H_ -#include <xf86Module.h> +/* check if it works without + +#include <xf86Module.h> */ /****************************************************************************** * Definitions @@ -66,7 +70,7 @@ SPACEORBPrivateRec, *SPACEORBPrivatePtr; /****************************************************************************** * Declarations *****************************************************************************/ -static MODULESETUPPROTO( SetupProc ); +static MODULESETUPPROTO(SPACEORBSetupProc); static void TearDownProc (pointer p); static Bool DeviceControl (DeviceIntPtr, int); static Bool DeviceOn (DeviceIntPtr); @@ -78,8 +82,12 @@ static int ControlProc (LocalDevicePtr, xDeviceCtl *); static void CloseProc (LocalDevicePtr); static int SwitchMode (ClientPtr, DeviceIntPtr, int); static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); -static Bool QueryHardware (SPACEORBPrivatePtr, int *, int *); +static Bool QueryHardware (SPACEORBPrivatePtr); +static void NewPacket (SPACEORBPrivatePtr priv); static Bool SPACEORBGetPacket (SPACEORBPrivatePtr priv); + +static InputInfoPtr +SpaceorbPreInit(InputDriverPtr drv, IDevPtr dev, int flags); /* * DO NOT PUT ANYTHING AFTER THIS ENDIF */ diff --git a/xc/programs/Xserver/hw/xfree86/input/summa/Imakefile b/xc/programs/Xserver/hw/xfree86/input/summa/Imakefile index 2c0b914e2..8afb07c52 100644 --- a/xc/programs/Xserver/hw/xfree86/input/summa/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/input/summa/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/Imakefile,v 1.4 1999/08/14 10:50:03 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/Imakefile,v 1.5 2000/08/11 19:10:47 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -6,10 +6,10 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/Imakefile,v 1.4 1999/ SRCS = xf86Summa.c OBJS = xf86Summa.o -DRIVER = xf86Summa +DRIVER = summa INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) diff --git a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c index d094da201..c23975d73 100644 --- a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c +++ b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c @@ -20,7 +20,79 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.3 1999/06/13 05:18:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.4 2000/08/11 19:10:48 dawes Exp $ */ + +static const char identification[] = "$Identification: 18 $"; + +#include <xf86Version.h> + +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) +#define XFREE86_V4 1 +#endif + +#ifdef XFREE86_V4 +/* post 3.9 headers */ + +#ifndef XFree86LOADER +#include <unistd.h> +#include <errno.h> +#endif + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#if !defined(DGUX) +#include <xf86_ansic.h> +#include <xisb.h> +#endif +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ +#include <keysym.h> +#include <mipointer.h> + +#ifdef XFree86LOADER +#include <xf86Module.h> +#endif + +#undef memset +#define memset xf86memset +#undef sleep +#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) +#define wait_for_fd(fd) xf86WaitForInput((fd), 1000) +#define tcflush(fd, n) xf86FlushInput((fd)) +#undef read +#define read(a,b,c) xf86ReadSerial((a),(b),(c)) +#undef write +#define write(a,b,c) xf86WriteSerial((a),(char*)(b),(c)) +#undef close +#define close(a) xf86CloseSerial((a)) +#define XCONFIG_PROBED "(==)" +#define XCONFIG_GIVEN "(**)" +#define xf86Verbose 1 +#undef PRIVATE +#define PRIVATE(x) XI_PRIVATE(x) + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ + +static const char *default_options[] = +{ + "BaudRate", "9600", + "DataBits", "8", + "StopBits", "1", + "Parity", "Odd", + "FlowControl", "Xoff", + "VTime", "10", + "VMin", "1", + NULL +}; + +static InputDriverPtr sumDrv; + +#else /* pre 3.9 headers */ #define NEED_EVENTS #include "X.h" @@ -61,6 +133,7 @@ #include "extnsionst.h" #include "extinit.h" #endif +#endif /* ** Debugging macros @@ -72,7 +145,7 @@ #undef DEBUG #endif -static int debug_level = 0; +static int debug_level = 5; #define DEBUG 1 #if DEBUG #define DBG(lvl, f) {if ((lvl) <= debug_level) f;} @@ -111,6 +184,9 @@ typedef struct ** Configuration data */ #define SUMMA_SECTION_NAME "SummaSketch" + +#ifndef XFREE86_V4 + #define PORT 1 #define DEVICENAME 2 #define THE_MODE 3 @@ -160,6 +236,8 @@ static SymTabRec SumPointTabRec[] = { #endif +#endif /* Pre 3.9 headers */ + /* ** Contants and macro */ @@ -198,6 +276,9 @@ static const char * ss_initstr = SS_TABID0 SS_UPPER_ORIGIN SS_BINARY_FMT SS_STRE /* ** External declarations */ + +#ifndef XFREE86_V4 + #if defined(sun) && !defined(i386) #define ENQUEUE suneqEnqueue #else @@ -218,6 +299,10 @@ extern void miPointerDeltaCursor( #endif ); +#endif + +#ifndef XFREE86_V4 + #if !defined(sun) || defined(i386) /* ** xf86SumConfig @@ -379,6 +464,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) return Success; } #endif +#endif /* ** xf86SumConvert @@ -561,8 +647,10 @@ static char * xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) { int err, numread = 0; +#ifndef XFREE86_V4 fd_set readfds; struct timeval timeout; +#endif SYSCALL(err = write(fd, data, strlen(data))); if (err == -1) { @@ -570,17 +658,24 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) return NULL; } +#ifndef XFREE86_V4 FD_ZERO(&readfds); FD_SET(fd, &readfds); +#endif while (numread < len) { +#ifndef XFREE86_V4 timeout.tv_sec = 0; timeout.tv_usec = 200000; SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); +#else + err = xf86WaitForInput(fd, 1000); +#endif if (err == -1) { Error("SummaSketch select"); return NULL; } + if (!err) { ErrorF("Timeout while reading SummaSketch tablet. No tablet connected ???\n"); return NULL; @@ -604,6 +699,7 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) return buffer; } + /* ** xf86SumOpen ** Open and initialize the tablet, as well as probe for any needed data. @@ -611,21 +707,27 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) static Bool xf86SumOpen(LocalDevicePtr local) { +#ifndef XFREE86_V4 struct termios termios_tty; struct timeval timeout; +#endif char buffer[256]; int err, idx; SummaDevicePtr priv = (SummaDevicePtr)local->private; DBG(1, ErrorF("opening %s\n", priv->sumDevice)); - +#ifdef XFREE86_V4 + local->fd = xf86OpenSerial(local->options); +#else SYSCALL(local->fd = open(priv->sumDevice, O_RDWR|O_NDELAY, 0)); +#endif if (local->fd == -1) { Error(priv->sumDevice); return !Success; } DBG(2, ErrorF("%s opened as fd %d\n", priv->sumDevice, local->fd)); +#ifndef XFREE86_V4 #ifdef POSIX_TTY err = tcgetattr(local->fd, &termios_tty); if (err == -1) { @@ -669,7 +771,13 @@ xf86SumOpen(LocalDevicePtr local) return !Success; } #else - Code for someone else to write to handle OSs without POSIX tty functions +#error Code for someone else to write to handle OSs without POSIX tty functions +#endif +#else +/* if (xf86SetSerialSpeed(local->fd, 9600) < 0) { + return !Success; + } +*/ #endif DBG(1, ErrorF("initializing SummaSketch tablet\n")); @@ -682,9 +790,13 @@ xf86SumOpen(LocalDevicePtr local) } /* wait 200 mSecs, just in case */ +#ifndef XFREE86_V4 timeout.tv_sec = 0; timeout.tv_usec = 200000; SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); +#else + err = xf86WaitForInput(-1, 200); +#endif if (err == -1) { Error("SummaSketch select"); return !Success; @@ -696,9 +808,12 @@ xf86SumOpen(LocalDevicePtr local) Error("SummaSketch write"); return !Success; } +#ifndef XFREE86_V4 /* Clear any pending input */ tcflush(local->fd, TCIFLUSH); - +#else + xf86FlushInput(local->fd); +#endif DBG(2, ErrorF("reading firmware ID\n")); if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1)) return !Success; @@ -887,8 +1002,9 @@ xf86SumProc(DeviceIntPtr pSum, int what) } /* allocate the motion history buffer if needed */ xf86MotionHistoryAllocate(local); - +#ifndef XFREE86_V4 AssignTypeAndName(pSum, local->atom, local->name); +#endif /* open the device to gather informations */ xf86SumOpenDevice(pSum); break; @@ -900,7 +1016,11 @@ xf86SumProc(DeviceIntPtr pSum, int what) return !Success; } SYSCALL(write(local->fd, SS_PROMPT, strlen(SS_PROMPT))); +#ifdef XFREE86_V4 + xf86AddEnabledDevice(local); +#else AddEnabledDevice(local->fd); +#endif pSum->public.on = TRUE; break; @@ -908,7 +1028,11 @@ xf86SumProc(DeviceIntPtr pSum, int what) DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); if (local->fd >= 0) - RemoveEnabledDevice(local->fd); +#ifdef XFREE86_V4 + xf86RemoveEnabledDevice(local); +#else + RemoveEnabledDevice(local->fd); +#endif pSum->public.on = FALSE; break; @@ -947,7 +1071,7 @@ xf86SumClose(LocalDevicePtr local) ** When I figure out what it does, it will do it. */ static int -xf86SumChangeControl(LocalDevicePtr local, pointer control) +xf86SumChangeControl(LocalDevicePtr local, xDeviceCtl* control) { xDeviceResolutionCtl *res; @@ -1001,18 +1125,34 @@ xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) static LocalDevicePtr xf86SumAllocate() { - LocalDevicePtr local = xalloc(sizeof(LocalDeviceRec)); - SummaDevicePtr priv = xalloc(sizeof(SummaDeviceRec)); + LocalDevicePtr local; + SummaDevicePtr priv; #if defined (sun) && !defined(i386) char *dev_name = getenv("SUMMASKETCH_DEV"); #endif + priv = xalloc(sizeof(SummaDeviceRec)); + if (!priv) + return NULL; + +#ifdef XFREE86_V4 + local = xf86AllocateInput(sumDrv, 0); +#else + local = xalloc(sizeof(LocalDeviceRec)); +#endif + if (!local) { + xfree(priv); + return NULL; + } + local->name = XI_NAME; local->type_name = "SummaSketch Tablet"; local->flags = 0; +#ifndef XFREE86_V4 #if !defined(sun) || defined(i386) local->device_config = xf86SumConfig; #endif +#endif local->device_control = xf86SumProc; local->read_input = xf86SumReadInput; local->control_proc = xf86SumChangeControl; @@ -1025,6 +1165,8 @@ xf86SumAllocate() local->private = priv; local->private_flags = 0; local->history_size = 0; + local->old_x = -1; + local->old_y = -1; #if defined(sun) && !defined(i386) if (def_name) { @@ -1048,13 +1190,13 @@ xf86SumAllocate() priv->sumXOffset = -1; /* active area X offset */ priv->sumYSize = -1; /* active area Y */ priv->sumYOffset = -1; /* active area U offset */ - priv->flags = 0; /* various flags */ + priv->flags = 0; /* various flags */ priv->sumIndex = 0; /* number of bytes read */ return local; } - +#ifndef XFREE86_V4 /* ** SummaSketch device association ** Device section name and allocation function. @@ -1089,45 +1231,224 @@ init_xf86Summa(unsigned long server_version) } #endif +#else + +/* + * xf86SumUninit -- + * + * called when the driver is unloaded. + */ +static void +xf86SumUninit(InputDriverPtr drv, + LocalDevicePtr local, + int flags) +{ + SummaDevicePtr priv = (SummaDevicePtr) local->private; + + DBG(1, ErrorF("xf86SumUninit\n")); + + xf86SumProc(local->dev, DEVICE_OFF); + + xfree (priv); + xf86DeleteInput(local, 0); +} + +/* + * xf86SumInit -- + * + * called when the module subsection is found in XF86Config + */ +static InputInfoPtr +xf86SumInit(InputDriverPtr drv, + IDevPtr dev, + int flags) +{ + LocalDevicePtr local = NULL; + SummaDevicePtr priv = NULL; + char *s; + + sumDrv = drv; + + DBG(1, ErrorF("xf86SumInit allocating...\n")); + + local = xf86SumAllocate(); + if (!local) + return NULL; + + local->conf_idev = dev; + + DBG(1, ErrorF("xf86SumInit CollectInputOptions...\n")); + xf86CollectInputOptions(local, default_options, NULL); + DBG(1, ErrorF("done.\n")); + xf86OptionListReport( local->options ); + + + priv = (SummaDevicePtr) local->private; + + local->name = dev->identifier; + + /* Serial Device is mandatory */ + priv->sumDevice = xf86FindOptionValue(local->options, "Device"); + + if (!priv->sumDevice) { + xf86Msg (X_ERROR, "%s: No Device specified.\n", dev->identifier); + goto SetupProc_fail; + } + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + /* Optional configuration */ + + xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, + priv->sumDevice); + + debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + if (debug_level > 0) { + xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level); + } + + + + s = xf86FindOptionValue(local->options, "Mode"); + + if (s && (xf86NameCmp(s, "absolute") == 0)) { + priv->flags = priv->flags | ABSOLUTE_FLAG; + } + else if (s && (xf86NameCmp(s, "relative") == 0)) { + priv->flags = priv->flags & ~ABSOLUTE_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name, + (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + + + s = xf86FindOptionValue(local->options, "Cursor"); + + if (s && (xf86NameCmp(s, "stylus") == 0)) { + priv->flags = priv->flags | STYLUS_FLAG; + } + else if (s && (xf86NameCmp(s, "puck") == 0)) { + priv->flags = priv->flags & ~STYLUS_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name, + (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); + + priv->sumXSize = xf86SetIntOption(local->options, "XSize", 0); + if (priv->sumXSize != 0) { + xf86Msg(X_CONFIG, "%s: XSize = %d\n", + dev->identifier, priv->sumXSize); + } + + priv->sumYSize = xf86SetIntOption(local->options, "YSize", 0); + if (priv->sumYSize != 0) { + xf86Msg(X_CONFIG, "%s: YSize = %d\n", + dev->identifier, priv->sumYSize); + } + + priv->sumXOffset = xf86SetIntOption(local->options, "XOffset", 0); + if (priv->sumXOffset != 0) { + xf86Msg(X_CONFIG, "%s: XOffset = %d\n", + dev->identifier, priv->sumXOffset); + } + + priv->sumYOffset = xf86SetIntOption(local->options, "YOffset", 0); + if (priv->sumYOffset != 0) { + xf86Msg(X_CONFIG, "%s: YOffset = %d\n", + dev->identifier, priv->sumYOffset); + } + + /* mark the device configured */ + local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; + + /* return the LocalDevice */ + return local; + + SetupProc_fail: + if (priv) + xfree(priv); + return local; +} + #ifdef XFree86LOADER +static +#endif +InputDriverRec SUMMA = { + 1, /* driver version */ + "summa", /* driver name */ + NULL, /* identify */ + xf86SumInit, /* pre-init */ + xf86SumUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + + /* - * Entry point for the loader code + *************************************************************************** + * + * Dynamic loading functions + * + *************************************************************************** */ -XF86ModuleVersionInfo xf86SummaVersion = { - "xf86Summa", +#ifdef XFree86LOADER +/* + * xf86SumUnplug -- + * + * called when the module subsection is found in XF86Config + */ +static void +xf86SumUnplug(pointer p) +{ + DBG(1, ErrorF("xf86SumUnplug\n")); +} + +/* + * xf86SumPlug -- + * + * called when the module subsection is found in XF86Config + */ +static pointer +xf86SumPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) +{ + DBG(1, ErrorF("xf86SumPlug\n")); + + xf86AddInputDriver(&SUMMA, module, 0); + + return module; +} + +static XF86ModuleVersionInfo xf86SumVersionRec = +{ + "summa", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XF86_VERSION_CURRENT, - 0x00010000, - {0,0,0,0} + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ }; -void -xf86SummaModuleInit(data, magic) - pointer *data; - INT32 *magic; -{ - static int cnt = 0; - - switch (cnt) { - case 0: - *magic = MAGIC_VERSION; - *data = &xf86SummaVersion; - cnt++; - break; - - case 1: - *magic = MAGIC_ADD_XINPUT_DEVICE; - *data = &summasketch_assoc; - cnt++; - break; - - default: - *magic = MAGIC_DONE; - *data = NULL; - break; - } -} -#endif +XF86ModuleData summaModuleData = {&xf86SumVersionRec, + xf86SumPlug, + xf86SumUnplug}; + +#endif /* XFree86LOADER */ +#endif /* XFREE86_V4 */ + + /* end of xf86Summa.c */ diff --git a/xc/programs/Xserver/hw/xfree86/input/void/void.c b/xc/programs/Xserver/hw/xfree86/input/void/void.c index e0f50c099..15cc38be9 100644 --- a/xc/programs/Xserver/hw/xfree86/input/void/void.c +++ b/xc/programs/Xserver/hw/xfree86/input/void/void.c @@ -1,4 +1,3 @@ -/* $XConsortium$ */ /* * Copyright 1999 by Frederic Lepied, France. <Lepied@XFree86.org> * @@ -22,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/void/void.c,v 1.1 1999/11/19 13:54:57 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/void/void.c,v 1.2 2000/08/11 19:10:48 dawes Exp $ */ /* Input device which doesn't output any event. This device can be used * as a core pointer or as a core keyboard. diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c index 05939b214..601256fcc 100644 --- a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c +++ b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.18 2000/03/03 20:36:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.19 2000/08/11 19:10:49 dawes Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -2868,6 +2868,27 @@ xf86WcmAllocate(char * name, char *dev_name = (char *) getenv("WACOM_DEV"); #endif + priv = (WacomDevicePtr) xalloc(sizeof(WacomDeviceRec)); + if (!priv) + return NULL; + + common = (WacomCommonPtr) xalloc(sizeof(WacomCommonRec)); + if (!common) { + xfree(priv); + return NULL; + } + +#ifdef XFREE86_V4 + local = xf86AllocateInput(wcmDrv, 0); +#else + local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); +#endif + if (!local) { + xfree(priv); + xfree(common); + return NULL; + } + local->name = name; local->flags = 0; #ifndef XFREE86_V4 @@ -2952,7 +2973,8 @@ xf86WcmAllocateStylus() { LocalDevicePtr local = xf86WcmAllocate(XI_STYLUS, STYLUS_ID); - local->type_name = "Wacom Stylus"; + if (local) + local->type_name = "Wacom Stylus"; return local; } @@ -2968,7 +2990,8 @@ xf86WcmAllocateCursor() { LocalDevicePtr local = xf86WcmAllocate(XI_CURSOR, CURSOR_ID); - local->type_name = "Wacom Cursor"; + if (local) + local->type_name = "Wacom Cursor"; return local; } @@ -2984,7 +3007,8 @@ xf86WcmAllocateEraser() { LocalDevicePtr local = xf86WcmAllocate(XI_ERASER, ABSOLUTE_FLAG|ERASER_ID); - local->type_name = "Wacom Eraser"; + if (local) + local->type_name = "Wacom Eraser"; return local; } @@ -3098,6 +3122,9 @@ xf86WcmInit(InputDriverPtr drv, wcmDrv = drv; fakeLocal = (LocalDevicePtr) xcalloc(1, sizeof(LocalDeviceRec)); + if (!fakeLocal) + return NULL; + fakeLocal->conf_idev = dev; /* Force default serial port options to exist because the serial init @@ -3124,15 +3151,14 @@ xf86WcmInit(InputDriverPtr drv, goto SetupProc_fail; } - if (local) - priv = (WacomDevicePtr) local->private; - if (priv) - common = priv->common; - - if (!local || !priv || !common) { - goto SetupProc_fail; + if (!local) { + xfree(fakeLocal); + return NULL; } - + + priv = (WacomDevicePtr) local->private; + common = priv->common; + local->options = fakeLocal->options; local->conf_idev = fakeLocal->conf_idev; local->name = dev->identifier; @@ -3304,9 +3330,7 @@ xf86WcmInit(InputDriverPtr drv, xfree(common); if (priv) xfree(priv); - if (local) - xfree(local); - return NULL; + return local; } #ifdef XFree86LOADER diff --git a/xc/programs/Xserver/hw/xfree86/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/int10/Imakefile index c8160fdaf..c526d182b 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/int10/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.9 2000/04/17 16:30:11 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.10 2000/08/09 02:33:49 tsi Exp $ /* An OS-independent INT10 module/library */ @@ -8,7 +8,7 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.9 2000/04/17 #if !UseX86Emu || (XF86INT10_BUILD == X86INT10_STUB) SRCS = xf86int10module.c stub.c -OBJS = xf86int10module.c stub.o +OBJS = xf86int10module.o stub.o #else @@ -35,7 +35,7 @@ X86EMUOBJS = x86emu.o X86EMUDEFINES = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -# if defined(i386Architecture) +# if defined(i386Architecture) || defined(ia64Architecture) ARCHDEFINES = -D_PC # endif diff --git a/xc/programs/Xserver/hw/xfree86/int10/generic.c b/xc/programs/Xserver/hw/xfree86/int10/generic.c index af12efe23..a39d2c897 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/generic.c +++ b/xc/programs/Xserver/hw/xfree86/int10/generic.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.9 2000/06/07 22:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.10 2000/07/13 21:31:38 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -74,7 +74,7 @@ xf86InitInt10(int entityIndex) pInt->mem = &genericMem; pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); INTPriv(pInt)->alloc = - (pointer)xnfcalloc(1,sizeof(ALLOC_ENTRIES(getpagesize()))); + (pointer)xnfcalloc(1,ALLOC_ENTRIES(getpagesize())); pInt->scrnIndex = screen; base = INTPriv(pInt)->base = xnfalloc(0xf0000); diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c index 437f88efd..39720dd84 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c +++ b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.4 2000/05/31 07:15:06 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.5 2000/07/13 21:31:38 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -578,17 +578,6 @@ pciCfg1out(CARD16 addr, CARD32 val) } #endif -CARD8 -bios_checksum(CARD8 *start, int size) -{ - int i; - CARD8 val = 0; - - for (i = 0; i < size; i++) - val += *start++; - return val; -} - /* * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make * an attempt to detect a legacy ISA card. If they find one they might diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c index 68bc8bbd8..c82191d05 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c +++ b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.6 2000/06/13 02:28:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.9 2000/07/26 01:52:23 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -169,31 +169,37 @@ int10_read_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem) { int size; + if (((codeSeg << 4) < V_BIOS) || ((codeSeg << 4) >= SYS_SIZE)) + return FALSE; + + if ((codeSeg << 4) >= SYS_BIOS) + return TRUE; + if (xf86IsPc98()) return FALSE; - if (xf86ReadBIOS(codeSeg << 4,0,(unsigned char *)vbiosMem, 0x10) < 0) { + if (xf86ReadBIOS(codeSeg << 4, 0, vbiosMem, 0x10) < 0) { xf86DrvMsg(scrnIndex,X_WARNING,"Cannot read V_BIOS (1)\n"); return FALSE; } - if (!((*(CARD8*)vbiosMem == 0x55) && (*((CARD8*)vbiosMem+1) == 0xAA))) + if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2) || + (*(vbiosMem+2) > 0x80U)) return FALSE; - size = *((CARD8*)vbiosMem + 2) * 512; + size = *(vbiosMem + 2) * 512; - if ((size + (codeSeg << 4)) > SYS_BIOS) + if ((size + (codeSeg << 4)) > SYS_SIZE) return FALSE; - + + /* We might already have the tail end */ + if ((size + (codeSeg << 4)) > SYS_BIOS) + size = SYS_BIOS - (codeSeg << 4); + if (xf86ReadBIOS(codeSeg << 4,0,vbiosMem, size) < 0) { xf86DrvMsg(scrnIndex,X_ERROR,"Cannot read V_BIOS (2)\n"); return FALSE; } - if (bios_checksum(vbiosMem,size)) { - xf86DrvMsg(scrnIndex,X_ERROR,"Bad checksum of V_BIOS \n"); - return FALSE; - } + return TRUE; } - - diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h index 733da37b9..39e2a2587 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h +++ b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.5 2000/04/17 16:30:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.6 2000/07/13 21:31:39 tsi Exp $ */ /* * XFree86 int10 module @@ -125,7 +125,6 @@ int port_rep_outw(xf86Int10InfoPtr pInt, CARD16 port, CARD32 base, int d_f, CARD32 count); int port_rep_outl(xf86Int10InfoPtr pInt, CARD16 port, CARD32 base, int d_f, CARD32 count); -CARD8 bios_checksum(CARD8 *start, int size); CARD8 x_inb(CARD16 port); CARD16 x_inw(CARD16 port); diff --git a/xc/programs/Xserver/hw/xfree86/loader/Imakefile b/xc/programs/Xserver/hw/xfree86/loader/Imakefile index 2504f5378..616352b28 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/loader/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.22 2000/02/23 19:21:16 alanh Exp $ */ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.23 2000/08/11 19:51:03 dawes Exp $ */ @@ -22,10 +22,6 @@ DLSRC=dlloader.c DLOBJ=dlloader.o #endif -#if defined(SunArchitecture) && defined(SVR4Architecture) && OSMinorVersion >= 8 -OSDEFINES = -DSOL8 -#endif - DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OSDEFINES) MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index d48a5ce5c..0b8ed7881 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c +++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.155 2000/06/30 19:06:58 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.159 2000/08/08 08:58:08 eich Exp $ */ /* * @@ -225,6 +225,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86MapVidMem) SYMFUNC(xf86UnMapVidMem) SYMFUNC(xf86MapReadSideEffects) + SYMFUNC(xf86UDelay) SYMFUNC(xf86IODelay) SYMFUNC(xf86SlowBcopy) #ifdef __alpha__ @@ -249,7 +250,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86SerialModemClearBits) SYMFUNC(xf86LoadKernelModule) SYMFUNC(xf86OSMouseInit) - + #ifdef XINPUT /* XISB routines (Merged from Metrolink tree) */ SYMFUNC(XisbNew) @@ -422,6 +423,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86GetAllowMouseOpenFail) SYMFUNC(xf86IsPc98) SYMFUNC(xf86GetClocks) + SYMFUNC(xf86SetPriority) SYMFUNC(xf86LoadDrvSubModule) SYMFUNC(xf86LoadSubModule) SYMFUNC(xf86UnloadSubModule) @@ -497,6 +499,9 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86OptionListReport) SYMFUNC(xf86SetIntOption) SYMFUNC(xf86SetStrOption) + SYMFUNC(xf86ReplaceIntOption) + SYMFUNC(xf86ReplaceStrOption) + SYMFUNC(xf86ReplaceBoolOption) SYMFUNC(xf86FindOption) SYMFUNC(xf86FindOptionValue) SYMFUNC(xf86MarkOptionUsed) @@ -761,14 +766,14 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86memcpy) #if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) /* - * These PPC and SPARC compilers generate calls to memcpy to handle + * Some PPC and SPARC compilers generate calls to memcpy to handle * structure copies. This causes a problem both here and in shared * libraries as there is no way to map the name of the call to the * correct function. */ SYMFUNC(memcpy) /* - * Thes PPC and SPARC compilers generate calls to memset to handle + * Some PPC and SPARC compilers generate calls to memset to handle * aggregate initializations. */ SYMFUNC(memset) @@ -822,6 +827,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86vfprintf) SYMFUNC(xf86vsnprintf) SYMFUNC(xf86vsprintf) + SYMFUNC(xf86write) /* non-ANSI C functions */ SYMFUNC(xf86opendir) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile index 91a9b8706..16f6058a5 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.41 2000/06/30 17:15:17 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.42 2000/08/10 17:40:34 dawes Exp $ @@ -38,6 +38,10 @@ OS_SUBDIR = sysv # endif #endif +#if defined(cygwinArchitecture) +OS_SUBDIR = cygwin +#endif + #if defined(SVR4Architecture) # if defined(SunArchitecture) # if OSMinorVersion < 8 diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c index fb251f19c..b5a9cb6f8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.34 2000/03/05 16:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.35 2000/08/11 17:27:15 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -332,11 +332,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) } /* else, mmap /dev/vga */ -#ifndef PC98 if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) -#else - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xE8000) -#endif { FatalError("%s: Address 0x%x outside allowable range\n", "xf86MapVidMem", Base); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c index a797fcb43..a47c637d2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.32 2000/06/20 19:40:31 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.33 2000/08/04 16:13:40 eich Exp $ */ /* * Pci.c - New server PCI access functions * @@ -1042,6 +1042,13 @@ xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, unsigned long Base, return((pointer)base); } +CARD32 +pciCheckForBrokenBase(PCITAG Tag,int basereg) +{ + pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0xffffffff); + return pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2)); +} + static int readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, unsigned char *Buf, int Len) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c index 1fd725cd2..0e984ce53 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c,v 1.7 1999/12/03 19:17:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c,v 1.8 2000/08/04 16:13:40 eich Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -101,8 +101,14 @@ axpPciCfgRead(PCITAG tag, int off) CARD32 val = 0xffffffff; bus = PCI_BUS_FROM_TAG(tag); + /* + * Workaround for kernel bug + * triggered when probing for PCI devices + */ + if (bus >= pciNumBuses) + return (val); dfn = PCI_DFN_FROM_TAG(tag); - + syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); return(val); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h index 80f306c42..bf1ee66b3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.24 2000/03/27 05:10:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.25 2000/08/04 16:13:40 eich Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -641,6 +641,7 @@ ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); PCITAG pciTag(int busnum, int devnum, int funcnum); int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); +CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg); pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, unsigned long Base, unsigned long Size); int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile new file mode 100644 index 000000000..8641a202d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile @@ -0,0 +1,48 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile,v 1.1 2000/08/10 17:40:35 dawes Exp $ + + + + +XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:23:58 rws $ + +#include <Server.tmpl> + +BIOS_MOD = bios_mmap + + +SRCS = cygwin_init.c ioperm_noop.c cygwin_io.c libc_wrapper.c cygwin_video.c \ + posix_tty.c stdPci.c $(BIOS_MOD).c VTsw_noop.c \ + stdResource.c sigiostubs.c std_kbdEv.c vidmem.c \ + stdResource.c stdPci.c sigiostubs.c pm_noop.c + +OBJS = cygwin_init.o ioperm_noop.o cygwin_io.o libc_wrapper.o cygwin_video.o \ + posix_tty.o stdPci.o $(BIOS_MOD).o VTsw_noop.o \ + stdResource.o sigiostubs.o std_kbdEv.o vidmem.o \ + stdResource.o stdPci.o sigiostubs.o pm_noop.o + +INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ + -I$(XINCLUDESRC) + +RESDEFINES = -DUSESTDRES +DEFINE = $(RESDEFINES) + +SubdirLibraryRule($(OBJS)) +NormalLibraryObjectRule() +NormalAsmObjectRule() + +ObjectFromSpecialSource(VTsw_noop,../shared/VTsw_noop,/**/) +ObjectFromSpecialSource(posix_tty,../shared/posix_tty,/**?) +ObjectFromSpecialSource(ioperm_noop,../shared/ioperm_noop,/**/) +ObjectFromSpecialSource(stdPci,../shared/stdPci,/**/) +ObjectFromSpecialSource(libc_wrapper,../shared/libc_wrapper,/**/) +ObjectFromSpecialSource(sigiostubs,../shared/sigiostubs,/**/) +ObjectFromSpecialSource(std_kbdEv,../shared/std_kbdEv,/**/) +ObjectFromSpecialSource(vidmem,../shared/vidmem,/**/) +ObjectFromSpecialSource(stdResource,../shared/stdResource,/**/) +ObjectFromSpecialSource(pm_noop,../shared/pm_noop,/**/) + + + + +DependTarget() + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c new file mode 100644 index 000000000..b1f867f31 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c @@ -0,0 +1,76 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c,v 1.1 2000/08/10 17:40:35 dawes Exp $ */ +/* + * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu> + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * 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 names of Robert Baron and David Wexelblat not + * be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Robert Baron and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * ROBERT BARON AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL ROBERT BARON OR DAVID WEXELBLAT 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. + * + */ +/* $XConsortium: bios_mmap.c /main/4 1996/02/21 17:51:47 kaleb $ */ + +#include "X.h" +#include "misc.h" + +#define DevicePtr int +#include "xf86_OSlib.h" + +#define BIOS_SIZE 0x20000 +#define KERN_SUCCESS 0 + +int xf86ReadBIOS(Base, Offset, Buf, Len) +unsigned long Base; +unsigned long Offset; +unsigned char *Buf; +int Len; +{ + /*int fd; + int screen_addr; + int ret; + + if ((fd = open("/dev/zero", O_RDWR, 0)) < 0) + { + ErrorF("xf86ReadBIOS: Failed to open /dev/zero\n"); + return(-1); + } + if (KERN_SUCCESS != vm_allocate(task_self(), &screen_addr, + BIOS_SIZE, TRUE)) + { + ErrorF("xf86ReadBIOS: Failed vmallocate %x\n", BIOS_SIZE); + close(fd); + return(-1); + } + if (mmap(screen_addr, BIOS_SIZE, 3, 1, fd, Base) < 0) + { + ErrorF("xf86ReadBIOS: Failed to mmap %x at %x\n", + BIOS_SIZE, Base); + vm_deallocate(task_self(), screen_addr, BIOS_SIZE); + close(fd); + return(-1); + } + memcpy(Buf, (unsigned char *)(screen_addr + Offset), Len); + if (KERN_SUCCESS != vm_deallocate(task_self(), screen_addr, BIOS_SIZE)) + { + ErrorF("xf86ReadBIOS: Failed vmdeallocate %x\n", BIOS_SIZE); + close(fd); + return(-1); + } + close(fd);*/ + return(Len); +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c new file mode 100644 index 000000000..9ec4c8353 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c @@ -0,0 +1,167 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c,v 1.2 2000/08/11 23:59:48 dawes Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * Copyright 1999 by David Holland <davidh@iquest.net> + * + * 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 names of Thomas Roell and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Thomas Roell and + * David Wexelblat makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID HOLLAND, THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DAVID HOLLAND, THOMAS ROELL OR DAVID WEXELBLAT 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. + * + */ +/* $XConsortium: cygwin_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ + +#include <signal.h> +#include <sys/time.h> +#include <unistd.h> + +#include "X.h" +#include "Xmd.h" + +#include "scrnintstr.h" +#include <errno.h> +#include <sys/mman.h> +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +static Bool KeepTty = FALSE; + +static Bool Protect0 = FALSE; + + +char fb_dev[PATH_MAX] = "/dev/conin"; + +#define MAX_SECONDS 60 +#define USEC_IN_SEC (unsigned long)1000000 + + +void +xf86OpenConsole() +{ + int fd; + int i; + MessageType from = X_PROBED; + + if (serverGeneration == 1) + { + /* check if we're run with euid==0 */ + if (geteuid() != 0) + { + FatalError("xf86OpenConsole: Server must be suid root\n"); + } + + /* Protect page 0 to help find NULL dereferencing */ + /* mprotect() doesn't seem to work */ + if (Protect0) + { + int fd = -1; + + if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) + { + xf86Msg(X_WARNING, + "xf86OpenConsole: cannot open /dev/zero (%s)\n", + strerror(errno)); + } + else + { + if ((int)mmap(0, 0x1000, PROT_NONE, + MAP_FIXED | MAP_SHARED, fd, 0) == -1) + { + xf86Msg(X_WARNING, + "xf86OpenConsole: failed to protect page 0 (%s)\n", + strerror(errno)); + } + close(fd); + } + } + + if (!KeepTty) + { + setpgrp(); + } + + if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0)) + { + FatalError("xf86OpenConsole: Cannot open %s (%s)\n", + fb_dev, strerror(errno)); + } + + } + return; +} + +void xf86CloseConsole() +{ + + int tmp; + + close(xf86Info.consoleFd); + + return; +} + +int xf86ProcessArgument(argc, argv, i) +int argc; +char *argv[]; +int i; +{ + /* + * Keep server from detaching from controlling tty. This is useful + * when debugging (so the server can receive keyboard signals. + */ + if (!strcmp(argv[i], "-keeptty")) + { + KeepTty = TRUE; + return(1); + } + /* + * Undocumented flag to protect page 0 from read/write to help + * catch NULL pointer dereferences. This is purely a debugging + * flag. + */ + if (!strcmp(argv[i], "-protect0")) + { + Protect0 = TRUE; + return(1); + } + if (!strcmp(argv[i], "-dev") && i+1 < argc) { + strncpy(fb_dev, argv[i+1], PATH_MAX); + fb_dev[PATH_MAX-1] = '\0'; + return(2); + } + + + return(0); +} + +void xf86UseMsg() +{ + ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n"); + ErrorF(" (If not using XKB)\n"); + ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n"); + ErrorF(" (If not using XKB)\n"); + ErrorF("-dev <fb> FrameBuffer device\n"); + ErrorF("-keeptty "); + ErrorF("don't detach controlling tty (for debugging only)\n"); + return; +} + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c new file mode 100644 index 000000000..92a196522 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c @@ -0,0 +1,121 @@ +/* + * (c) Copyright 1998 by Sebastien Marineau + * <sebastien@qnx.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Sebastien Marineau shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Sebastien Marineau. + * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c,v 1.1 2000/08/10 17:40:35 dawes Exp $ + */ + +/* This module contains the qnx-specific functions to access the keyboard + * and the console. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + +#include <sys/mman.h> +#include <sys/ioctl.h> +#include <errno.h> + +#include <X.h> +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + + +void xf86KbdOn() +{ + + return; +} + +void +xf86SoundKbdBell(loudness, pitch, duration) +int loudness, pitch, duration; +{ + +/* Come back and fix! */ +ErrorF("xf86SoundKbdBell: to implement\n"); +} + +void +xf86SetKbdLeds(leds) +int leds; +{ +/* This just a dumb thing*/ + return; +} + +int +xf86GetKbdLeds() +{ + return; +} + +/* This is a no-op for now */ +void +xf86SetKbdRepeat(rad) +char rad; +{ + return; +} + + +/* This is a no-op for now */ +void +xf86KbdInit() +{ + + return; +} + +void +xf86KbdOff() +{ + + return; +} + + +void xf86MouseInit() +{ + return; +} + +void OsVendorVErrorFProc() +{ + return FALSE; +} + +void xf86ProtocolIDToName() +{ + return FALSE; +} + +void OsVendorErrorFProc() +{ + return FALSE; +} + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c new file mode 100644 index 000000000..7103eb5d0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c @@ -0,0 +1,165 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c,v 1.1 2000/08/10 17:40:36 dawes Exp $ */ +/* + * Copyright 1993-1999 by The XFree86 Project, Inc + * + */ + +#include "X.h" +#include "input.h" +#include "scrnintstr.h" +#include <sys/mman.h> + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" +#include "xf86_OSproc.h" + +/* + * This file contains the common part of the video memory mapping functions + */ + +/* + * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold + * the MTRR option information, but it is likely to be expanded if we do + * auto unmapping of memory at VT switch. + * + */ + +typedef struct { + unsigned long physBase; + unsigned long size; + pointer virtBase; + pointer mtrrInfo; + int flags; +} MappingRec, *MappingPtr; + +typedef struct { + int numMappings; + MappingPtr * mappings; + Bool mtrrEnabled; + MessageType mtrrFrom; + Bool mtrrOptChecked; + ScrnInfoPtr pScrn; +} VidMapRec, *VidMapPtr; + +static int vidMapIndex = -1; + +#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr)) + +static VidMemInfo vidMemInfo = {FALSE, }; + +static VidMapPtr +getVidMapRec(int scrnIndex) +{ + VidMapPtr vp; + + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + if (vidMapIndex < 0) + vidMapIndex = xf86AllocateScrnInfoPrivateIndex(); + + if (VIDMAPPTR(pScrn) != NULL) + return VIDMAPPTR(pScrn); + + vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1); + vp->mtrrEnabled = TRUE; /* default to enabled */ + vp->mtrrFrom = X_DEFAULT; + vp->mtrrOptChecked = FALSE; + vp->pScrn = pScrn; + return vp; +} + +static MappingPtr +newMapping(VidMapPtr vp) +{ + vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) * + (vp->numMappings + 1)); + vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1); + return vp->mappings[vp->numMappings++]; +} + +static MappingPtr +findMapping(VidMapPtr vp, pointer vbase, unsigned long size) +{ + int i; + + for (i = 0; i < vp->numMappings; i++) { + if (vp->mappings[i]->virtBase == vbase && + vp->mappings[i]->size == size) + return vp->mappings[i]; + } + return NULL; +} + +static void +removeMapping(VidMapPtr vp, MappingPtr mp) +{ + int i, found = 0; + + for (i = 0; i < vp->numMappings; i++) { + if (vp->mappings[i] == mp) { + found = 1; + xfree(vp->mappings[i]); + } else if (found) { + vp->mappings[i - 1] = vp->mappings[i]; + } + } + vp->numMappings--; + vp->mappings[vp->numMappings] = NULL; +} + +enum { OPTION_MTRR }; +static OptionInfoRec opts[] = +{ + { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +static void +checkMtrrOption(VidMapPtr vp) +{ + if (!vp->mtrrOptChecked && vp->pScrn->options != NULL) { + /* + * We get called once for each screen, so reset + * the OptionInfoRecs. + */ + opts[0].found = FALSE; + + xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, + opts); + if (xf86GetOptValBool(opts, OPTION_MTRR, &vp->mtrrEnabled)) + vp->mtrrFrom = X_CONFIG; + vp->mtrrOptChecked = TRUE; + } +} + + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool xf86DisableInterrupts() +{ + /* allow interrupt disabling but check for side-effects. + * Not a good policy ... + */ + __asm__ __volatile__("sti"); + return TRUE; +} + +void xf86EnableInterrupts() +{ + /*Reenable*/ + __asm__ __volatile__ ("sti"); +} + + + +/***************************************************************************/ +/* Initialize video memory */ +/***************************************************************************/ + +void xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile new file mode 100644 index 000000000..1343d8b5e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile @@ -0,0 +1,110 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile,v 1.1 2000/08/10 17:40:36 dawes Exp $ + +#define IHaveModules + +#include <Server.tmpl> + +SRCS1 = pci.c xf86int10module.c helper_exec.c helper_mem.c xf86int10.c +OBJS1 = pci.o xf86int10module.o helper_exec.o helper_mem.o xf86int10.o + +LinkSourceFile(helper_mem.c,$(XF86SRC)/int10) +LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) +LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) +LinkSourceFile(pci.c,$(XF86SRC)/int10) +LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10) +LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) +LinkSourceFile(generic.c,$(XF86SRC)/int10) + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ + -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) + +DEFINES=-DHAVE_SYSV_IPC + +#if 0 +/* debugging stuff */ +#DEFINES =-D_PC +#undef XF86INT10_BUILD +#define XF86INT10_BUILD X86EMU_GENERIC +#define X86EMU_LIBPATH /usr/local/lib +#endif + +#if defined(i386Architecture) +DEFINES =-D_PC +#endif + +/* XXX keep this temporarily for reference */ +#if 0 +#if (XF86INT10_BUILD == X86EMU_GENERIC) + +SRCS = $(SRCS1) xf86x86emu.c generic.c +OBJS = $(OBJS1) xf86x86emu.o generic.o x86emu.o +SpecialObjectRule(pci.o, pci.c, -D_X86EMU) +SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) +SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) +SpecialObjectRule(generic.o, generic.c, -D_X86EMU) +SpecialObjectRule(xf86x86emu.o, xf86x86emu.c, -D_X86EMU) +BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) +#endif +#endif + +#if defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM) + +SRCS = $(SRCS1) linux.c +OBJS = $(OBJS1) linux.o +SpecialObjectRule(pci.o, pci.c, -D_VM86_LINUX) +SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) +SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) +SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX -DHAVE_SYSV_IPC) + +#elif (XF86INT10_BUILD == X86EMU_OS) + +SpecialObjectRule(pci.o, pci.c, -D_X86EMU) +SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) +SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) +SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) + +X86TOPDIR = $(TOP)/extras/x86emu +X86SRCDIR = $(X86TOPDIR)/src/x86emu +X86EMUINCLUDES = -I$(X86TOPDIR)/include -I$(X86SRCDIR) + +# if !defined(X86EMU_LIBPATH) +X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c +X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o + +LinkSourceFile(debug.c,$(X86SRCDIR)) +LinkSourceFile(decode.c,$(X86SRCDIR)) +LinkSourceFile(fpu.c,$(X86SRCDIR)) +LinkSourceFile(ops.c,$(X86SRCDIR)) +LinkSourceFile(ops2.c,$(X86SRCDIR)) +LinkSourceFile(prim_ops.c,$(X86SRCDIR)) +LinkSourceFile(sys.c,$(X86SRCDIR)) +# else +BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) +X86EMUOBJS = x86emu.o +# endif + +SRCS = $(SRCS1) xf86x86emu.c linux.c $(X86EMUSRCS) +OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS) + +#endif + +#if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC + +LibraryModuleTarget(int10, $(OBJS)) + +InstallLibraryModule(int10,$(MODULEDIR),linux) + +all:: + (set -x; cd ../..; \ + RemoveFile(LibraryTargetName(int10)); \ + $(LN) linux/int10/LibraryTargetName(int10) . ) + +InstallDriverSDKLibraryModule(int10,$(DRIVERSDKMODULEDIR),.) + +InstallDriverSDKNonExecFile(../../int10/xf86int10.h,$(DRIVERSDKINCLUDEDIR)) + +#endif + +DependTarget() + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c new file mode 100644 index 000000000..9da256ec2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c @@ -0,0 +1,451 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c,v 1.1 2000/08/10 17:40:36 dawes Exp $ */ +/* + * XFree86 int10 module + * execute BIOS int 10h calls in x86 real mode environment + * Copyright 1999 Egbert Eich + */ +#include "xf86.h" +#include "xf86str.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "compiler.h" +#define _INT10_PRIVATE +#include "xf86int10.h" +#include "int10Defines.h" + +static CARD8 read_b(xf86Int10InfoPtr pInt,int addr); +static CARD16 read_w(xf86Int10InfoPtr pInt,int addr); +static CARD32 read_l(xf86Int10InfoPtr pInt,int addr); +static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val); +static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val); +static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val); + +/* + * the emulator cannot pass a pointer to the current xf86Int10InfoRec + * to the memory access functions therefore store it here. + */ + +typedef struct { + int shift; + int pagesize_1; + int entries; + void* vRam; + memType *alloc_rec; +} genericInt10Priv; + +#define INTPriv(x) ((genericInt10Priv*)x->private) + +int10MemRec genericMem = { + read_b, + read_w, + read_l, + write_b, + write_w, + write_l +}; + +static void MapVRam(xf86Int10InfoPtr pInt); +static void UnmapVRam(xf86Int10InfoPtr pInt); +static void setupTable(xf86Int10InfoPtr pInt, memType address, + int loc,int size); + +static void *sysMem = NULL; + +xf86Int10InfoPtr +xf86InitInt10(int entityIndex) +{ + xf86Int10InfoPtr pInt; + int screen; + void* intMem; + void* vbiosMem; + int pagesize; + int entries; + int shift; + legacyVGARec vga; + + screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + + if (int10skip(xf86Screens[screen],entityIndex)) + return NULL; + + pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); + pInt->entityIndex = entityIndex; + if (!xf86Int10ExecSetup(pInt)) + goto error0; + pInt->mem = &genericMem; + pagesize = xf86getpagesize(); + pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); + entries = SYS_SIZE / pagesize; + + pInt->scrnIndex = screen; + INTPriv(pInt)->pagesize_1 = pagesize - 1; + INTPriv(pInt)->entries = entries; + INTPriv(pInt)->alloc_rec = + xnfcalloc(1,sizeof(memType) * entries); + for (shift = 0 ; (pagesize >> shift) ; shift++) {}; + shift -= 1; + INTPriv(pInt)->shift = shift; + + /* + * we need to map video RAM MMIO as some chipsets map mmio + * registers into this range. + */ + + MapVRam(pInt); + intMem = xnfalloc(pagesize); + setupTable(pInt,(memType)intMem,0,pagesize); + vbiosMem = xnfalloc(V_BIOS_SIZE); + +#ifdef _PC + if (!sysMem) + sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE); + setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); + if (xf86ReadBIOS(0,0,(unsigned char *)intMem,LOW_PAGE_SIZE) < 0) { + xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); + goto error1; + } + if (xf86IsEntityPrimary(entityIndex)) { + int size; + int cs = MEM_RW(pInt,((0x10<<2)+2)); + +int i,k,m; +char buf[100], hx[10]; +for (i=0; i<0x100; i+=16) { +sprintf(buf,"%04x: ",i); +for (k=0; k<16; k++) { + m = MEM_RB(pInt,i+k); + sprintf(hx,"%02x ",((unsigned)m)&0xff); + strcat(buf,hx); +} +xf86DrvMsg(screen,X_INFO,"%s\n",buf); +} + + + + xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segmant is: 0x%x\n",cs); + if (xf86ReadBIOS(cs << 4,0,(unsigned char *)vbiosMem, + 0x10) < 0) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (1)\n"); + goto error1; + } + if (!((*(CARD8*)vbiosMem == 0x55) + && (*((CARD8*)vbiosMem + 1) == 0xAA))) { + xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); + goto error1; + } + + size = *((CARD8*)vbiosMem + 2) * 512; + if (xf86ReadBIOS(cs << 4,0,vbiosMem, size) < 0) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (2)\n"); + goto error1; + } + if (bios_checksum(vbiosMem,size)) { + xf86DrvMsg(screen,X_ERROR,"Bad checksum of V_BIOS \n"); + goto error1; + } + + setupTable(pInt,(memType)vbiosMem,cs<<4,size); + set_return_trap(pInt); + pInt->BIOSseg = cs; + } else { + reset_int_vect(pInt); + set_return_trap(pInt); + if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); + goto error1; + } + setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); + pInt->BIOSseg = V_BIOS >> 4; + pInt->num = 0xe6; + LockLegacyVGA(screen, &vga); + xf86ExecX86int10(pInt); + UnlockLegacyVGA(screen, &vga); + } +#else + if (!sysMem) { + sysMem = xnfalloc(BIOS_SIZE); + setup_system_bios((memType)sysMem); + } + setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); + setup_int_vect(pInt); + set_return_trap(pInt); + if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); + goto error1; + } + setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); + pInt->BIOSseg = V_BIOS >> 4; + pInt->num = 0xe6; + LockLegacyVGA(screen, &vga); + xf86ExecX86int10(pInt); + UnlockLegacyVGA(screen, &vga); +#endif + return pInt; + + error1: + xfree(vbiosMem); + xfree(intMem); + UnmapVRam(pInt); + xfree(INTPriv(pInt)->alloc_rec); + xfree(pInt->private); + error0: + xfree(pInt); + + return NULL; +} + +static void +MapVRam(xf86Int10InfoPtr pInt) +{ + int screen = pInt->scrnIndex; + int pagesize = INTPriv(pInt)->pagesize_1 + 1; + int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; + INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size); +} + +static void +UnmapVRam(xf86Int10InfoPtr pInt) +{ + int screen = pInt->scrnIndex; + int pagesize = INTPriv(pInt)->pagesize_1 + 1; + int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; + + xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); +} + +void +MapCurrentInt10(xf86Int10InfoPtr pInt) +{ + /* nothing to do here */ +} + +void +xf86FreeInt10(xf86Int10InfoPtr pInt) +{ + int pagesize; + + if (!pInt) + return; + pagesize = INTPriv(pInt)->pagesize_1 + 1; + if (Int10Current == pInt) + Int10Current = NULL; + xfree(INTPriv(pInt)->alloc_rec[V_BIOS/pagesize]); + xfree(INTPriv(pInt)->alloc_rec[0]); + UnmapVRam(pInt); + xfree(INTPriv(pInt)->alloc_rec); + xfree(pInt->private); + xfree(pInt); +} + +void * +xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) +{ + void* addr; + int pagesize = INTPriv(pInt)->pagesize_1 + 1; + int num_pages = INTPriv(pInt)->entries; + int i,j; + + for (i=0;i<num_pages - num;i++) { + if (INTPriv(pInt)->alloc_rec[i] == 0) { + for (j=i;j < num + i;j++) + if ((INTPriv(pInt)->alloc_rec[j] != 0)) + break; + if (j == num + i) + break; + else + i = i + num; + } + } + if (i == num_pages - num) + return NULL; + + *off = i * pagesize; + addr = xnfalloc(pagesize * num); + setupTable(pInt,(memType)addr,*off,pagesize * num); + + return addr; +} + +void +xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) +{ + int num_pages = INTPriv(pInt)->entries; + int i,j; + for (i = 0;i<num_pages - num; i++) + if (INTPriv(pInt)->alloc_rec[i]==(memType)pbase) { + for (j = 0; j < num; j++) + INTPriv(pInt)->alloc_rec[i] = 0; + break; + } + xfree(pbase); + return; +} + +static void +setupTable(xf86Int10InfoPtr pInt, memType address,int loc,int size) +{ + int pagesize = INTPriv(pInt)->pagesize_1 + 1; + int i,j,num; + + i = loc / pagesize; + num = (size + pagesize - 1)/ pagesize; /* round up to the nearest page */ + /* boudary if size is not */ + /* multiple of pagesize */ + for (j = 0; j<num; j++) { + INTPriv(pInt)->alloc_rec[i+j] = address; + address += pagesize; + } +} + +#define OFF(addr) \ + ((addr) & (INTPriv(pInt)->pagesize_1)) +#define SHIFT \ + (INTPriv(pInt)->shift) +#define BASE(addr,shift) \ + (INTPriv(pInt)->alloc_rec[addr >> shift]) +#define V_ADDR(addr,shift,off) \ + (BASE(addr,shift) + (off)) +#define VRAM_ADDR(addr) (addr - 0xA0000) +#define VRAM_BASE (INTPriv(pInt)->vRam) + +#define VRAM(addr) ((addr >= 0xA0000) && (addr <= 0xBFFFF)) +#define V_ADDR_RB(addr,shift,off) \ + (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ + : *(CARD8*) V_ADDR(addr,shift,off) +#define V_ADDR_RW(addr,shift,off) \ + (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldw_u((pointer)V_ADDR(addr,shift,off)) +#define V_ADDR_RL(addr,shift,off) \ + (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldl_u((pointer)V_ADDR(addr,shift,off)) + +#define V_ADDR_WB(addr,shift,off,val) \ + if(VRAM(addr)) \ + MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + *(CARD8*) V_ADDR(addr,shift,off) = val; +#define V_ADDR_WW(addr,shift,off,val) \ + if(VRAM(addr)) \ + MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + stw_u((val),(pointer)(V_ADDR(addr,shift,off))); + +#define V_ADDR_WL(addr,shift,off,val) \ + if (VRAM(addr)) \ + MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + stl_u(val,(pointer)(V_ADDR(addr,shift,off))); + +static CARD8 +read_b(xf86Int10InfoPtr pInt, int addr) +{ + if (!BASE(addr,SHIFT)) return 0xff; + + return V_ADDR_RB(addr,SHIFT,OFF(addr)); +} + +static CARD16 +read_w(xf86Int10InfoPtr pInt, int addr) +{ + int shift = SHIFT; + int off = OFF(addr); + + if (!BASE(addr,shift)) return 0xffff; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + return ((V_ADDR_RB(addr,shift,off)) + || ((V_ADDR_RB(addr,shift,off + 1)) << 8)); +#else + if (OFF(addr + 1) > 0) { + return V_ADDR_RW(addr,SHIFT,OFF(addr)); + } else { + return ((V_ADDR_RB(addr,shift,off + 1)) + || ((V_ADDR_RB(addr,shift,off)) << 8)); + } +#endif +} + +static CARD32 +read_l(xf86Int10InfoPtr pInt, int addr) +{ + int shift = SHIFT; + int off = OFF(addr); + + if (!BASE(addr,shift)) return 0xffffffff; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + return ((V_ADDR_RB(addr,shift,off)) + || ((V_ADDR_RB(addr,shift,off + 1)) << 8) + || ((V_ADDR_RB(addr,shift,off + 2)) << 16) + || ((V_ADDR_RB(addr,shift,off + 3)) << 24)); +#else + if (OFF(addr + 3) > 2) { + return V_ADDR_RL(addr,SHIFT,OFF(addr)); + } else { + return ((V_ADDR_RB(addr,shift,off + 3)) + || ((V_ADDR_RB(addr,shift,off + 2)) << 8) + || ((V_ADDR_RB(addr,shift,off + 1)) << 16) + || ((V_ADDR_RB(addr,shift,off)) << 24)); + } +#endif +} + +static void +write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) +{ + if (!BASE(addr,SHIFT)) return; + + V_ADDR_WB(addr,SHIFT,OFF(addr),val); +} + +static void +write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) +{ + int shift = SHIFT; + int off = OFF(addr); + + if (!BASE(addr,shift)) return; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + V_ADDR_WB(addr,shift,off,val); + V_ADDR_WB(addr,shift,off + 1,val >> 8); +#else + if (OFF(addr + 1) > 0) { + V_ADDR_WW(addr,shift,OFF(addr),val); + } else { + V_ADDR_WB(addr,shift,off + 1,val); + V_ADDR_WB(addr,shift,off,val >> 8); + } +#endif +} + +static void +write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) +{ + int shift = SHIFT; + int off = OFF(addr); + if (!BASE(addr,shift)) return; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + V_ADDR_WB(addr,shift,off,val); + V_ADDR_WB(addr,shift,off + 1, val >> 8); + V_ADDR_WB(addr,shift,off + 2, val >> 16); + V_ADDR_WB(addr,shift,off + 3, val >> 24); +#else + if (OFF(addr + 3) > 2) { + V_ADDR_WL(addr,shift,OFF(addr),val); + } else { + V_ADDR_WB(addr,shift,off + 3, val); + V_ADDR_WB(addr,shift,off + 2, val >> 8); + V_ADDR_WB(addr,shift,off + 1, val >> 16); + V_ADDR_WB(addr,shift,off, val >> 24); + } +#endif +} + +pointer +xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) +{ + return (pointer) V_ADDR(addr,SHIFT,OFF(addr)); +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c b/xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c index 91b839708..59be86646 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c,v 1.5 2000/06/27 14:27:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c,v 1.6 2000/07/11 01:46:37 tsi Exp $ */ /* * INTEL DG/UX RELEASE 4.20 MU03 * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK @@ -82,32 +82,12 @@ Bool xf86LinearVidMem() return(TRUE); } - - -pointer AllocAddress[MAXSCREENS][NUM_REGIONS]; -#ifndef SVR4 -static int mmapFd = -2; -#endif - - - -#if 0 -/* For DGA support?? */ -static struct xf86memMap { - int offset; - int memSize; -} xf86memMaps[MAXSCREENS]; -#endif - - - pointer xf86MapVidMem(int ScreenNum, int Region, unsigned long Base, unsigned long Size) { pointer base; int fd; -#if defined(DGUX) if ((fd = open(DEV_MEM, O_RDWR)) < 0) { FatalError("xf86MapVidMem: failed to open %s (%s)\n", @@ -121,77 +101,10 @@ xf86MapVidMem(int ScreenNum, int Region, unsigned long Base, unsigned long Size) FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", "xf86MapVidMem", Size, Base, strerror(errno)); } -#else /* HAS SVR#_MMAPDRV */ -#ifdef HAS_SVR3_MMAPDRV - if (mmapFd == -2) - { - mmapFd = open("/dev/mmap", O_RDWR); - } -#endif - if (mmapFd >= 0) - { - /* To force the MMAP driver to provide the address */ - base = (pointer)0; - } - else - { - AllocAddress[ScreenNum][Region] = xalloc(Size + 0x1000); - if (AllocAddress[ScreenNum][Region] == (pointer)0) - { - FatalError("xf86MapVidMem: can't alloc framebuffer space\n"); - /* NOTREACHED */ - } - base = (pointer)(((unsigned int)AllocAddress[ScreenNum][Region] - & ~0xFFF) + 0x1000); - } - -#ifdef HAS_SVR3_MMAPDRV - if(mmapFd >= 0) - { - if((base = (pointer)ioctl(mmapFd, MAP, - &(MapDSC[ScreenNum][Region]))) == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - /* NOTREACHED */ - } - -#if 0 -/* inserted for DGA support */ - xf86memMaps[ScreenNum].offset = Base; - xf86memMaps[ScreenNum].memSize = Size; -#endif - return((pointer)base); - } -#endif -#endif /* DGUX */ -#if 0 - xf86memMaps[ScreenNum].offset = Base; - xf86memMaps[ScreenNum].memSize = Size; -#endif return(base); } - - - - - -#if 0 -void xf86GetVidMemData(ScreenNum, Base, Size) -int ScreenNum; -int *Base; -int *Size; -{ - *Base = xf86memMaps[ScreenNum].offset; - *Size = xf86memMaps[ScreenNum].memSize; -} -#endif - - - - void xf86UnMapVidMem(ScreenNum, Region, Base, Size) int ScreenNum; int Region; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index ecc196bdd..9e93331af 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -24,6 +24,7 @@ # 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/os-support/linux/drm/kernel/Makefile.linux,v 1.9 2000/08/04 03:51:47 tsi Exp $ # # ***** NOTE NOTE NOTE NOTE NOTE ***** # To override the automatic Linux source tree determination, pass the @@ -47,7 +48,7 @@ # **** End of SMP/MODVERSIONS detection -MODS= gamma.o tdfx.o r128.o +MODS= gamma.o tdfx.o r128.o sis.o LIBS= libdrm.a PROGS= drmstat @@ -64,6 +65,9 @@ TDFXHEADERS= tdfx_drv.h $(DRMHEADERS) R128OBJS= r128_drv.o r128_dma.o r128_bufs.o r128_context.o R128HEADERS= r128_drv.h r128_drm.h $(DRMHEADERS) +SISOBJS= sis_drv.o sis_context.o sis_ds.o sis_mm.o +SISHEADERS= sis_drv.h sis_ds.h sis_drm_public.h $(DRMHEADERS) + PROGOBJS= drmstat.po xf86drm.po xf86drmHash.po xf86drmRandom.po sigio.po PROGHEADERS= xf86drm.h $(DRMHEADERS) @@ -173,6 +177,9 @@ tdfx.o: $(TDFXOBJS) $(LIBS) r128.o: $(R128OBJS) $(LIBS) $(LD) -r $^ -o $@ +sis.o: $(SISOBJS) $(LIBS) + $(LD) -r $^ -o $@ + ifeq ($(AGP),1) mga.o: $(MGAOBJS) $(LIBS) $(LD) -r $^ -o $@ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index 4affcc415..5a979e1cb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -353,6 +353,8 @@ typedef struct drm_agp_info { #define DRM_IOCTL_I810_GETAGE DRM_IO ( 0x44) #define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) #define DRM_IOCTL_I810_SWAP DRM_IO ( 0x46) +#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO ( 0x48) /* Rage 128 specific ioctls */ #define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c index 96b7a44fe..901be5593 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c @@ -184,23 +184,29 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp) int retcode = 0; if(buf_priv->currently_mapped == I810_BUF_MAPPED) return -EINVAL; - down(¤t->mm->mmap_sem); - old_fops = filp->f_op; - filp->f_op = &i810_buffer_fops; - dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, - PROT_READ|PROT_WRITE, - MAP_SHARED, - buf->bus_address); - dev_priv->mmap_buffer = NULL; - filp->f_op = old_fops; - if ((unsigned long)buf_priv->virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed int)buf_priv->virtual; - buf_priv->virtual = 0; + + if(VM_DONTCOPY != 0) { + down(¤t->mm->mmap_sem); + old_fops = filp->f_op; + filp->f_op = &i810_buffer_fops; + dev_priv->mmap_buffer = buf; + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_DEBUG("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; + } + up(¤t->mm->mmap_sem); + } else { + buf_priv->virtual = buf_priv->kernel_virtual; + buf_priv->currently_mapped = I810_BUF_MAPPED; } - up(¤t->mm->mmap_sem); return retcode; } @@ -209,13 +215,22 @@ static int i810_unmap_buffer(drm_buf_t *buf) drm_i810_buf_priv_t *buf_priv = buf->dev_private; int retcode = 0; - if(buf_priv->currently_mapped != I810_BUF_MAPPED) return -EINVAL; - down(¤t->mm->mmap_sem); - retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual, - (size_t) buf->total); + if(VM_DONTCOPY != 0) { + if(buf_priv->currently_mapped != I810_BUF_MAPPED) + return -EINVAL; + down(¤t->mm->mmap_sem); +#if LINUX_VERSION_CODE < 0x020399 + retcode = do_munmap((unsigned long)buf_priv->virtual, + (size_t) buf->total); +#else + retcode = do_munmap(current->mm, + (unsigned long)buf_priv->virtual, + (size_t) buf->total); +#endif + up(¤t->mm->mmap_sem); + } buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->virtual = 0; - up(¤t->mm->mmap_sem); return retcode; } @@ -1354,3 +1369,43 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, return retcode; } + +int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i810_copy_t d; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; + drm_buf_t *buf; + drm_i810_buf_priv_t *buf_priv; + drm_device_dma_t *dma = dev->dma; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_dma called without lock held\n"); + return -EINVAL; + } + + copy_from_user_ret(&d, (drm_i810_copy_t *)arg, sizeof(d), -EFAULT); + + if(d.idx > dma->buf_count) return -EINVAL; + buf = dma->buflist[ d.idx ]; + buf_priv = buf->dev_private; + if (buf_priv->currently_mapped != I810_BUF_MAPPED) return -EPERM; + + copy_from_user_ret(buf_priv->virtual, d.address, d.used, -EFAULT); + + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + if(VM_DONTCOPY == 0) return 1; + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h index 4c8e09f6a..c5f51c9ad 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h @@ -178,6 +178,12 @@ typedef struct _drm_i810_vertex { int discard; /* client is finished with the buffer? */ } drm_i810_vertex_t; +typedef struct _drm_i810_copy_t { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + void *address; /* Address to copy from */ +} drm_i810_copy_t; + typedef struct drm_i810_dma { void *virtual; int request_idx; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c index 6f78fbc99..d7fa9d88b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c @@ -42,7 +42,7 @@ EXPORT_SYMBOL(i810_cleanup); #define I810_DESC "Intel I810" #define I810_DATE "19991213" #define I810_MAJOR 1 -#define I810_MINOR 0 +#define I810_MINOR 1 #define I810_PATCHLEVEL 0 static drm_device_t i810_device; @@ -112,6 +112,8 @@ static drm_ioctl_desc_t i810_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, }; #define I810_IOCTL_COUNT DRM_ARRAY_SIZE(i810_ioctls) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h index c387bf727..f5411c0bc 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h @@ -106,7 +106,10 @@ extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid); extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); - +extern int i810_copybuf(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i810_docopy(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); /* i810_bufs.c */ extern int i810_addbufs(struct inode *inode, struct file *filp, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c new file mode 100644 index 000000000..cabd3868b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c @@ -0,0 +1,213 @@ +/* sis_context.c -- IOCTLs for sis contexts -*- linux-c -*- + * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@precisioninsight.com> + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + +#include <linux/sched.h> + +#define __NO_VERSION__ +#include "drmP.h" +#include "sis_drv.h" + +extern drm_ctx_t sis_res_ctx; + +static int sis_alloc_queue(drm_device_t *dev) +{ + static int context = 0; + + return ++context; /* Should this reuse contexts in the future? */ +} + +int sis_context_switch(drm_device_t *dev, int old, int new) +{ + char buf[64]; + + atomic_inc(&dev->total_ctx); + + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return -EBUSY; + } + +#if DRM_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG("Context switch from %d to %d\n", old, new); + + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } + + if (drm_flags & DRM_FLAG_NOCTX) { + sis_context_switch_complete(dev, new); + } else { + sprintf(buf, "C %d %d\n", old, new); + drm_write_string(dev, buf); + } + + return 0; +} + +int sis_context_switch_complete(drm_device_t *dev, int new) +{ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("Lock isn't held after context switch\n"); + } + + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ +#if DRM_DMA_HISTOGRAM + atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() + - dev->ctx_start)]); + +#endif + clear_bit(0, &dev->context_flag); + wake_up(&dev->context_wait); + + return 0; +} + + +int sis_resctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); + copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT); + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + copy_to_user_ret(&res.contexts[i], + &i, + sizeof(i), + -EFAULT); + } + } + res.count = DRM_RESERVED_CONTEXTS; + copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT); + return 0; +} + + +int sis_addctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if ((ctx.handle = sis_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { + /* Skip kernel's context and get a new one. */ + ctx.handle = sis_alloc_queue(dev); + } + DRM_DEBUG("%d\n", ctx.handle); + + /* new added */ + sis_init_context(ctx.handle); + + copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int sis_modctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + if (ctx.flags==_DRM_CONTEXT_PRESERVED) + sis_res_ctx.handle=ctx.handle; + return 0; +} + +int sis_getctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + /* This is 0, because we don't hanlde any context flags */ + ctx.flags = 0; + copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int sis_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + return sis_context_switch(dev, dev->last_context, ctx.handle); +} + +int sis_newctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + sis_context_switch_complete(dev, ctx.handle); + + return 0; +} + +int sis_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + /* This is currently a noop because we + don't reuse context values. Perhaps we + should? */ + + /* new added */ + sis_final_context(ctx.handle); + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm_public.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm_public.h new file mode 100644 index 000000000..dd14a5a57 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm_public.h @@ -0,0 +1,32 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm_public.h,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + +#ifndef _sis_drm_public_h_ +#define _sis_drm_public_h_ + +typedef struct { + int context; + unsigned int offset; + unsigned int size; + unsigned int free; +} drm_sis_mem_t; + +typedef struct { + unsigned int offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned int left, right; +} drm_sis_flip_t; + +#define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t) +#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) + +#define SIS_IOCTL_AGP_INIT DRM_IOWR( 0x53, drm_sis_agp_t) +#define SIS_IOCTL_AGP_ALLOC DRM_IOWR( 0x54, drm_sis_mem_t) +#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) + +#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) +#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) +#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c new file mode 100644 index 000000000..1e8abb7fb --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c @@ -0,0 +1,715 @@ +/* sis.c -- sis driver -*- linux-c -*- + * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@precisioninsight.com> + * Daryll Strauss <daryll@precisioninsight.com> + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + +#include <linux/config.h> +#include "drmP.h" +#include "sis_drm_public.h" +#include "sis_drv.h" + +#define SIS_NAME "sis" +#define SIS_DESC "sis" +#define SIS_DATE "19991009" +#define SIS_MAJOR 0 +#define SIS_MINOR 0 +#define SIS_PATCHLEVEL 1 + +static drm_device_t sis_device; +drm_ctx_t sis_res_ctx; + +static struct file_operations sis_fops = { + open: sis_open, + flush: drm_flush, + release: sis_release, + ioctl: sis_ioctl, + mmap: drm_mmap, + read: drm_read, + fasync: drm_fasync, + poll: drm_poll, +}; + +static struct miscdevice sis_misc = { + minor: MISC_DYNAMIC_MINOR, + name: SIS_NAME, + fops: &sis_fops, +}; + +static drm_ioctl_desc_t sis_ioctls[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { sis_version, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { sis_addctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { sis_rmctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { sis_modctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { sis_getctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { sis_switchctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { sis_newctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { sis_resctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { sis_lock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { sis_unlock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, + +#ifdef DRM_AGP + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, +#endif + + /* FB Memory Management */ + [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 }, + + /* AGP Memory Management */ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sis_agp_init, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sis_agp_alloc, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sis_agp_free, 1, 1 }, + +#if defined(SIS_STEREO) + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 }, +#endif +}; +#define SIS_IOCTL_COUNT DRM_ARRAY_SIZE(sis_ioctls) + +#ifdef MODULE +static char *sis = NULL; +#endif + +MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_DESCRIPTION("sis"); +MODULE_PARM(sis, "s"); + +static int sis_setup(drm_device_t *dev) +{ + int i; + + atomic_set(&dev->ioctl_count, 0); + atomic_set(&dev->vma_count, 0); + dev->buf_use = 0; + atomic_set(&dev->buf_alloc, 0); + + atomic_set(&dev->total_open, 0); + atomic_set(&dev->total_close, 0); + atomic_set(&dev->total_ioctl, 0); + atomic_set(&dev->total_irq, 0); + atomic_set(&dev->total_ctx, 0); + atomic_set(&dev->total_locks, 0); + atomic_set(&dev->total_unlocks, 0); + atomic_set(&dev->total_contends, 0); + atomic_set(&dev->total_sleeps, 0); + + for (i = 0; i < DRM_HASH_SIZE; i++) { + dev->magiclist[i].head = NULL; + dev->magiclist[i].tail = NULL; + } + dev->maplist = NULL; + dev->map_count = 0; + dev->vmalist = NULL; + dev->lock.hw_lock = NULL; + init_waitqueue_head(&dev->lock.lock_queue); + dev->queue_count = 0; + dev->queue_reserved = 0; + dev->queue_slots = 0; + dev->queuelist = NULL; + dev->irq = 0; + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma = 0; + dev->dma_flag = 0; + dev->last_context = 0; + dev->last_switch = 0; + dev->last_checked = 0; + init_timer(&dev->timer); + init_waitqueue_head(&dev->context_wait); + + dev->ctx_start = 0; + dev->lck_start = 0; + + dev->buf_rp = dev->buf; + dev->buf_wp = dev->buf; + dev->buf_end = dev->buf + DRM_BSZ; + dev->buf_async = NULL; + init_waitqueue_head(&dev->buf_readers); + init_waitqueue_head(&dev->buf_writers); + + sis_res_ctx.handle=-1; + + DRM_DEBUG("\n"); + + /* The kernel's context could be created here, but is now created + in drm_dma_enqueue. This is more resource-efficient for + hardware that does not do DMA, but may mean that + drm_select_queue fails between the time the interrupt is + initialized and the time the queues are initialized. */ + + return 0; +} + + +static int sis_takedown(drm_device_t *dev) +{ + int i; + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_vma_entry_t *vma, *vma_next; + + DRM_DEBUG("\n"); + +#if defined(SIS_STEREO) + if (dev->irq) sis_irq_uninstall(dev); +#endif + + down(&dev->struct_sem); + del_timer(&dev->timer); + + if (dev->devname) { + drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); + dev->devname = NULL; + } + + if (dev->unique) { + drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); + dev->unique = NULL; + dev->unique_len = 0; + } + /* Clear pid list */ + for (i = 0; i < DRM_HASH_SIZE; i++) { + for (pt = dev->magiclist[i].head; pt; pt = next) { + next = pt->next; + drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); + } + dev->magiclist[i].head = dev->magiclist[i].tail = NULL; + } +#ifdef DRM_AGP + /* Clear AGP information */ + if (dev->agp) { + drm_agp_mem_t *entry; + drm_agp_mem_t *nexte; + + /* Remove AGP resources, but leave dev->agp + intact until cleanup is called. */ + for (entry = dev->agp->memory; entry; entry = nexte) { + nexte = entry->next; + if (entry->bound) drm_unbind_agp(entry->memory); + drm_free_agp(entry->memory, entry->pages); + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + } + dev->agp->memory = NULL; + + if (dev->agp->acquired && drm_agp.release) + (*drm_agp.release)(); + + dev->agp->acquired = 0; + dev->agp->enabled = 0; + } +#endif + + /* Clear vma list (only built for debugging) */ + if (dev->vmalist) { + for (vma = dev->vmalist; vma; vma = vma_next) { + vma_next = vma->next; + drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); + } + dev->vmalist = NULL; + } + + /* Clear map area and mtrr information */ + if (dev->maplist) { + for (i = 0; i < dev->map_count; i++) { + map = dev->maplist[i]; + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#ifdef CONFIG_MTRR + if (map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } +#endif + drm_ioremapfree(map->handle, map->size); + break; + case _DRM_SHM: + drm_free_pages((unsigned long)map->handle, + drm_order(map->size) + - PAGE_SHIFT, + DRM_MEM_SAREA); + break; + case _DRM_AGP: + /* Do nothing here, because this is all + handled in the AGP/GART driver. */ + break; + } + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + } + drm_free(dev->maplist, + dev->map_count * sizeof(*dev->maplist), + DRM_MEM_MAPS); + dev->maplist = NULL; + dev->map_count = 0; + } + + if (dev->lock.hw_lock) { + dev->lock.hw_lock = NULL; /* SHM removed */ + dev->lock.pid = 0; + wake_up_interruptible(&dev->lock.lock_queue); + } + up(&dev->struct_sem); + + return 0; +} + +/* sis_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). */ + +int sis_init(void) +{ + int retcode; + drm_device_t *dev = &sis_device; + + DRM_DEBUG("\n"); + + memset((void *)dev, 0, sizeof(*dev)); + dev->count_lock = SPIN_LOCK_UNLOCKED; + sema_init(&dev->struct_sem, 1); + +#ifdef MODULE + drm_parse_options(sis); +#endif + + if ((retcode = misc_register(&sis_misc))) { + DRM_ERROR("Cannot register \"%s\"\n", SIS_NAME); + return retcode; + } + dev->device = MKDEV(MISC_MAJOR, sis_misc.minor); + dev->name = SIS_NAME; + + drm_mem_init(); + drm_proc_init(dev); + +#ifdef DRM_AGP + DRM_DEBUG("doing agp init\n"); + dev->agp = drm_agp_init(); + if(dev->agp == NULL) { + /* TODO, if no agp, run MMIO mode */ + DRM_INFO("The sis drm module requires the agpgart module" + " to function correctly\nPlease load the agpgart" + " module before you load the mga module\n"); + drm_proc_cleanup(); + misc_deregister(&sis_misc); + sis_takedown(dev); + return -ENOMEM; + } +#ifdef CONFIG_MTRR + dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * 1024 * 1024, + MTRR_TYPE_WRCOMB, + 1); +#endif +#endif + + DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", + SIS_NAME, + SIS_MAJOR, + SIS_MINOR, + SIS_PATCHLEVEL, + SIS_DATE, + sis_misc.minor); + + return 0; +} + +/* sis_cleanup is called via cleanup_module at module unload time. */ + +void sis_cleanup(void) +{ + drm_device_t *dev = &sis_device; + + DRM_DEBUG("\n"); + + drm_proc_cleanup(); + if (misc_deregister(&sis_misc)) { + DRM_ERROR("Cannot unload module\n"); + } else { + DRM_INFO("Module unloaded\n"); + } +#ifdef DRM_AGP +#ifdef CONFIG_MTRR + if(dev->agp && dev->agp->agp_mtrr) { + int retval; + retval = mtrr_del(dev->agp->agp_mtrr, + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * 1024*1024); + DRM_DEBUG("mtrr_del = %d\n", retval); + } +#endif +#endif + + sis_takedown(dev); +#ifdef DRM_AGP + if (dev->agp) { + drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); + dev->agp = NULL; + } +#endif +} + +int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_version_t version; + int len; + + copy_from_user_ret(&version, + (drm_version_t *)arg, + sizeof(version), + -EFAULT); + +#define DRM_COPY(name,value) \ + len = strlen(value); \ + if (len > name##_len) len = name##_len; \ + name##_len = strlen(value); \ + if (len && name) { \ + copy_to_user_ret(name, value, len, -EFAULT); \ + } + + version.version_major = SIS_MAJOR; + version.version_minor = SIS_MINOR; + version.version_patchlevel = SIS_PATCHLEVEL; + + DRM_COPY(version.name, SIS_NAME); + DRM_COPY(version.date, SIS_DATE); + DRM_COPY(version.desc, SIS_DESC); + + copy_to_user_ret((drm_version_t *)arg, + &version, + sizeof(version), + -EFAULT); + return 0; +} + +int sis_open(struct inode *inode, struct file *filp) +{ + drm_device_t *dev = &sis_device; + int retcode = 0; + + DRM_DEBUG("open_count = %d\n", dev->open_count); + + if (!(retcode = drm_open_helper(inode, filp, dev))) { + MOD_INC_USE_COUNT; + atomic_inc(&dev->total_open); + spin_lock(&dev->count_lock); + if (!dev->open_count++) { + spin_unlock(&dev->count_lock); + return sis_setup(dev); + } + spin_unlock(&dev->count_lock); + } + return retcode; +} + +int sis_release(struct inode *inode, struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode = 0; + + DRM_DEBUG("open_count = %d\n", dev->open_count); + + if (!(retcode = drm_release(inode, filp))) { + MOD_DEC_USE_COUNT; + atomic_inc(&dev->total_close); + spin_lock(&dev->count_lock); + if (!--dev->open_count) { + if (atomic_read(&dev->ioctl_count) || dev->blocked) { + DRM_ERROR("Device busy: %d %d\n", + atomic_read(&dev->ioctl_count), + dev->blocked); + spin_unlock(&dev->count_lock); + return -EBUSY; + } + spin_unlock(&dev->count_lock); + return sis_takedown(dev); + } + spin_unlock(&dev->count_lock); + } + return retcode; +} + +/* sis_ioctl is called whenever a process performs an ioctl on /dev/drm. */ + +int sis_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + int nr = DRM_IOCTL_NR(cmd); + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode = 0; + drm_ioctl_desc_t *ioctl; + drm_ioctl_t *func; + + atomic_inc(&dev->ioctl_count); + atomic_inc(&dev->total_ioctl); + ++priv->ioctl_count; + + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", + current->pid, cmd, nr, dev->device, priv->authenticated); + + if (nr >= SIS_IOCTL_COUNT) { + retcode = -EINVAL; + } else { + ioctl = &sis_ioctls[nr]; + func = ioctl->func; + + if (!func) { + DRM_DEBUG("no function\n"); + retcode = -EINVAL; + } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) + || (ioctl->auth_needed && !priv->authenticated)) { + retcode = -EACCES; + } else { + retcode = (func)(inode, filp, cmd, arg); + } + } + + atomic_dec(&dev->ioctl_count); + return retcode; +} + +int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DECLARE_WAITQUEUE(entry, current); + int ret = 0; + drm_lock_t lock; +#if DRM_DMA_HISTOGRAM + cycles_t start; + + dev->lck_start = start = get_cycles(); +#endif + + copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + + if (lock.context == DRM_KERNEL_CONTEXT) { + DRM_ERROR("Process %d using kernel context %d\n", + current->pid, lock.context); + return -EINVAL; + } + + DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", + lock.context, current->pid, dev->lock.hw_lock->lock, + lock.flags); + +#if 0 + /* dev->queue_count == 0 right now for + sis. FIXME? */ + if (lock.context < 0 || lock.context >= dev->queue_count) + return -EINVAL; +#endif + + if (!ret) { +#if 0 + if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) + != lock.context) { + long j = jiffies - dev->lock.lock_time; + + if (lock.context == sis_res_ctx.handle && + j >= 0 && j < DRM_LOCK_SLICE) { + /* Can't take lock if we just had it and + there is contention. */ + DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", + lock.context, current->pid, j, + dev->lock.lock_time, jiffies); + current->state = TASK_INTERRUPTIBLE; + current->policy |= SCHED_YIELD; + schedule_timeout(DRM_LOCK_SLICE-j); + DRM_DEBUG("jiffies=%d\n", jiffies); + } + } +#endif + add_wait_queue(&dev->lock.lock_queue, &entry); + for (;;) { + if (!dev->lock.hw_lock) { + /* Device has been unregistered */ + ret = -EINTR; + break; + } + if (drm_lock_take(&dev->lock.hw_lock->lock, + lock.context)) { + dev->lock.pid = current->pid; + dev->lock.lock_time = jiffies; + atomic_inc(&dev->total_locks); + break; /* Got lock */ + } + + /* Contention */ + atomic_inc(&dev->total_sleeps); + current->state = TASK_INTERRUPTIBLE; + current->policy |= SCHED_YIELD; + schedule(); + if (signal_pending(current)) { + ret = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue(&dev->lock.lock_queue, &entry); + } + +#if 0 + if (!ret && dev->last_context != lock.context && + lock.context != sis_res_ctx.handle && + dev->last_context != sis_res_ctx.handle) { + add_wait_queue(&dev->context_wait, &entry); + current->state = TASK_INTERRUPTIBLE; + /* PRE: dev->last_context != lock.context */ + sis_context_switch(dev, dev->last_context, lock.context); + /* POST: we will wait for the context + switch and will dispatch on a later call + when dev->last_context == lock.context + NOTE WE HOLD THE LOCK THROUGHOUT THIS + TIME! */ + current->policy |= SCHED_YIELD; + schedule(); + current->state = TASK_RUNNING; + remove_wait_queue(&dev->context_wait, &entry); + if (signal_pending(current)) { + ret = -EINTR; + } else if (dev->last_context != lock.context) { + DRM_ERROR("Context mismatch: %d %d\n", + dev->last_context, lock.context); + } + } +#endif + + if (!ret) { + if (lock.flags & _DRM_LOCK_READY) { + /* Wait for space in DMA/FIFO */ + } + if (lock.flags & _DRM_LOCK_QUIESCENT) { + /* Make hardware quiescent */ +#if 0 + sis_quiescent(dev); +#endif + } + } + + if (lock.context != sis_res_ctx.handle) { + current->counter = 5; + current->priority = DEF_PRIORITY/4; + } + + DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); + +#if DRM_DMA_HISTOGRAM + atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); +#endif + + return ret; +} + + +int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_lock_t lock; + + copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + + if (lock.context == DRM_KERNEL_CONTEXT) { + DRM_ERROR("Process %d using kernel context %d\n", + current->pid, lock.context); + return -EINVAL; + } + + DRM_DEBUG("%d frees lock (%d holds)\n", + lock.context, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); + atomic_inc(&dev->total_unlocks); + if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) + atomic_inc(&dev->total_contends); + drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); + /* FIXME: Try to send data to card here */ + if (!dev->context_flag) { + if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT)) { + DRM_ERROR("\n"); + } + } + + if (lock.context != sis_res_ctx.handle) { + current->counter = 5; + current->priority = DEF_PRIORITY; + } + + return 0; +} + +module_init(sis_init); +module_exit(sis_cleanup); + +#ifndef MODULE +/* + * sis_setup is called by the kernel to parse command-line options passed + * via the boot-loader (e.g., LILO). It calls the insmod option routine, + * drm_parse_options. + */ +static int __init sis_options(char *str) +{ + drm_parse_options(str); + return 1; +} + +__setup("sis=", sis_options); +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h new file mode 100644 index 000000000..50f6efade --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h @@ -0,0 +1,99 @@ +/* sis_drv.h -- Private header for sis driver -*- linux-c -*- + * Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@precisioninsight.com> + * Daryll Strauss <daryll@precisioninsight.com> + * + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + +#ifndef _SIS_DRV_H_ +#define _SIS_DRV_H_ + + /* sis_drv.c */ +extern int sis_init(void); +extern void sis_cleanup(void); +extern int sis_version(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_open(struct inode *inode, struct file *filp); +extern int sis_release(struct inode *inode, struct file *filp); +extern int sis_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_irq_install(drm_device_t *dev, int irq); +extern int sis_irq_uninstall(drm_device_t *dev); +extern int sis_control(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_lock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_unlock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + + /* sis_context.c */ + +extern int sis_resctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_addctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_modctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_getctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_switchctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_newctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int sis_rmctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int sis_context_switch(drm_device_t *dev, int old, int new); +extern int sis_context_switch_complete(drm_device_t *dev, int new); + +int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); + + +int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); + +int sis_flip(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_flip_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_flip_final(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +void flip_final(void); + +int sis_init_context(int contexy); +int sis_final_context(int context); + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c new file mode 100644 index 000000000..592722c7d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c @@ -0,0 +1,377 @@ +#define __NO_VERSION__ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/malloc.h> +#include <linux/poll.h> +#include <asm/io.h> +#include <linux/pci.h> + +#include "sis_ds.h" + +/* Set Data Structure, not check repeated value + * temporarily used + */ + +set_t *setInit(void) +{ + int i; + set_t *set; + + set = (set_t *)MALLOC(sizeof(set_t)); + for(i = 0; i < SET_SIZE; i++){ + set->list[i].free_next = i+1; + set->list[i].alloc_next = -1; + } + set->list[SET_SIZE-1].free_next = -1; + set->free = 0; + set->alloc = -1; + set->trace = -1; + + return set; +} + +int setAdd(set_t *set, ITEM_TYPE item) +{ + int free = set->free; + + if(free != -1){ + set->list[free].val = item; + set->free = set->list[free].free_next; + } + else{ + return 0; + } + + set->list[free].alloc_next = set->alloc; + set->alloc = free; + set->list[free].free_next = -1; + + return 1; +} + +int setDel(set_t *set, ITEM_TYPE item) +{ + int alloc = set->alloc; + int prev = -1; + + while(alloc != -1){ + if(set->list[alloc].val == item){ + if(prev != -1) + set->list[prev].alloc_next = set->list[alloc].alloc_next; + else + set->alloc = set->list[alloc].alloc_next; + break; + } + prev = alloc; + alloc = set->list[alloc].alloc_next; + } + + if(alloc == -1) + return 0; + + set->list[alloc].free_next = set->free; + set->free = alloc; + set->list[alloc].alloc_next = -1; + + return 1; +} + +/* setFirst -> setAdd -> setNext is wrong */ + +int setFirst(set_t *set, ITEM_TYPE *item) +{ + if(set->alloc == -1) + return 0; + + *item = set->list[set->alloc].val; + set->trace = set->list[set->alloc].alloc_next; + + return 1; +} + +int setNext(set_t *set, ITEM_TYPE *item) +{ + if(set->trace == -1) + return 0; + + *item = set->list[set->trace].val; + set->trace = set->list[set->trace].alloc_next; + + return 1; +} + +int setDestroy(set_t *set) +{ + FREE(set); + + return 1; +} + +/* + * GLX Hardware Device Driver common code + * Copyright (C) 1999 Keith Whitwell + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c,v 1.1 2000/08/01 20:52:27 dawes Exp $ */ + +#define ISFREE(bptr) ((bptr)->free) + +#define PRINTF(fmt, arg...) do{}while(0) +#define fprintf(fmt, arg...) do{}while(0) + +static void *calloc(size_t nmemb, size_t size) +{ + void *addr; + addr = kmalloc(nmemb*size, GFP_KERNEL); + memset(addr, 0, nmemb*size); + return addr; +} +#define free(n) kfree(n) + +void mmDumpMemInfo( memHeap_t *heap ) +{ + TMemBlock *p; + + PRINTF ("Memory heap %p:\n", heap); + if (heap == 0) { + PRINTF (" heap == 0\n"); + } else { + p = (TMemBlock *)heap; + while (p) { + PRINTF (" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size, + p->free ? '.':'U', + p->reserved ? 'R':'.'); + p = p->next; + } + } + PRINTF ("End of memory blocks\n"); +} + +memHeap_t *mmInit(int ofs, + int size) +{ + PMemBlock blocks; + + if (size <= 0) { + return 0; + } + blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock)); + if (blocks) { + blocks->ofs = ofs; + blocks->size = size; + blocks->free = 1; + return (memHeap_t *)blocks; + } else + return 0; +} + +/* Kludgey workaround for existing i810 server. Remove soon. + */ +memHeap_t *mmAddRange( memHeap_t *heap, + int ofs, + int size ) +{ + PMemBlock blocks; + blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock)); + if (blocks) { + blocks[0].size = size; + blocks[0].free = 1; + blocks[0].ofs = ofs; + blocks[0].next = &blocks[1]; + + /* Discontinuity - stops JoinBlock from trying to join non-adjacent + * ranges. + */ + blocks[1].size = 0; + blocks[1].free = 0; + blocks[1].ofs = ofs+size; + blocks[1].next = (PMemBlock) heap; + return (memHeap_t *)blocks; + } + else + return heap; +} + +static TMemBlock* SliceBlock(TMemBlock *p, + int startofs, int size, + int reserved, int alignment) +{ + TMemBlock *newblock; + + /* break left */ + if (startofs > p->ofs) { + newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); + newblock->ofs = startofs; + newblock->size = p->size - (startofs - p->ofs); + newblock->free = 1; + newblock->next = p->next; + p->size -= newblock->size; + p->next = newblock; + p = newblock; + } + + /* break right */ + if (size < p->size) { + newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); + newblock->ofs = startofs + size; + newblock->size = p->size - size; + newblock->free = 1; + newblock->next = p->next; + p->size = size; + p->next = newblock; + } + + /* p = middle block */ + p->align = alignment; + p->free = 0; + p->reserved = reserved; + return p; +} + +PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch) +{ + int mask,startofs,endofs; + TMemBlock *p; + + if (!heap || align2 < 0 || size <= 0) + return NULL; + mask = (1 << align2)-1; + startofs = 0; + p = (TMemBlock *)heap; + while (p) { + if (ISFREE(p)) { + startofs = (p->ofs + mask) & ~mask; + if ( startofs < startSearch ) { + startofs = startSearch; + } + endofs = startofs+size; + if (endofs <= (p->ofs+p->size)) + break; + } + p = p->next; + } + if (!p) + return NULL; + p = SliceBlock(p,startofs,size,0,mask+1); + p->heap = heap; + return p; +} + +static __inline__ int Join2Blocks(TMemBlock *p) +{ + if (p->free && p->next && p->next->free) { + TMemBlock *q = p->next; + p->size += q->size; + p->next = q->next; + free(q); + return 1; + } + return 0; +} + +int mmFreeMem(PMemBlock b) +{ + TMemBlock *p,*prev; + + if (!b) + return 0; + if (!b->heap) { + fprintf(stderr, "no heap\n"); + return -1; + } + p = b->heap; + prev = NULL; + while (p && p != b) { + prev = p; + p = p->next; + } + if (!p || p->free || p->reserved) { + if (!p) + fprintf(stderr, "block not found in heap\n"); + else if (p->free) + fprintf(stderr, "block already free\n"); + else + fprintf(stderr, "block is reserved\n"); + return -1; + } + p->free = 1; + Join2Blocks(p); + if (prev) + Join2Blocks(prev); + return 0; +} + +int mmReserveMem(memHeap_t *heap, int offset,int size) +{ + int endofs; + TMemBlock *p; + + if (!heap || size <= 0) + return -1; + endofs = offset+size; + p = (TMemBlock *)heap; + while (p && p->ofs <= offset) { + if (ISFREE(p) && endofs <= (p->ofs+p->size)) { + SliceBlock(p,offset,size,1,1); + return 0; + } + p = p->next; + } + return -1; +} + +int mmFreeReserved(memHeap_t *heap, int offset) +{ + TMemBlock *p,*prev; + + if (!heap) + return -1; + p = (TMemBlock *)heap; + prev = NULL; + while (p && p->ofs != offset) { + prev = p; + p = p->next; + } + if (!p || !p->reserved) + return -1; + p->free = 1; + p->reserved = 0; + Join2Blocks(p); + if (prev) + Join2Blocks(prev); + return 0; +} + +void mmDestroy(memHeap_t *heap) +{ + TMemBlock *p,*q; + + if (!heap) + return; + p = (TMemBlock *)heap; + while (p) { + q = p->next; + free(p); + p = q; + } +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.h new file mode 100644 index 000000000..87a8b03db --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.h @@ -0,0 +1,135 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.h,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + +#ifndef _sis_ds_h_ +#define _sis_ds_h_ + +/* Set Data Structure */ + +#define SET_SIZE 5000 +#define MALLOC(s) kmalloc(s, GFP_KERNEL) +#define FREE(s) kfree(s) + +typedef unsigned int ITEM_TYPE; + +typedef struct { + ITEM_TYPE val; + int alloc_next, free_next; +} list_item_t; + +typedef struct { + int alloc; + int free; + int trace; + list_item_t list[SET_SIZE]; +} set_t; + +set_t *setInit(void); +int setAdd(set_t *set, ITEM_TYPE item); +int setDel(set_t *set, ITEM_TYPE item); +int setFirst(set_t *set, ITEM_TYPE *item); +int setNext(set_t *set, ITEM_TYPE *item); +int setDestroy(set_t *set); + +#endif + +/* + * GLX Hardware Device Driver common code + * Copyright (C) 1999 Keith Whitwell + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef MM_INC +#define MM_INC + +struct mem_block_t { + struct mem_block_t *next; + struct mem_block_t *heap; + int ofs,size; + int align; + int free:1; + int reserved:1; +}; +typedef struct mem_block_t TMemBlock; +typedef struct mem_block_t *PMemBlock; + +/* a heap is just the first block in a chain */ +typedef struct mem_block_t memHeap_t; + +static __inline__ int mmBlockSize(PMemBlock b) +{ return b->size; } + +static __inline__ int mmOffset(PMemBlock b) +{ return b->ofs; } + +static __inline__ void mmMarkReserved(PMemBlock b) +{ b->reserved = 1; } + +/* + * input: total size in bytes + * return: a heap pointer if OK, NULL if error + */ +memHeap_t *mmInit( int ofs, int size ); + + + +memHeap_t *mmAddRange( memHeap_t *heap, + int ofs, + int size ); + + +/* + * Allocate 'size' bytes with 2^align2 bytes alignment, + * restrict the search to free memory after 'startSearch' + * depth and back buffers should be in different 4mb banks + * to get better page hits if possible + * input: size = size of block + * align2 = 2^align2 bytes alignment + * startSearch = linear offset from start of heap to begin search + * return: pointer to the allocated block, 0 if error + */ +PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch ); + +/* + * Free block starts at offset + * input: pointer to a block + * return: 0 if OK, -1 if error + */ +int mmFreeMem( PMemBlock b ); + +/* + * Reserve 'size' bytes block start at offset + * This is used to prevent allocation of memory already used + * by the X server for the front buffer, pixmaps, and cursor + * input: size, offset + * output: 0 if OK, -1 if error + */ +int mmReserveMem( memHeap_t *heap, int offset,int size ); +int mmFreeReserved( memHeap_t *heap, int offset ); + +/* + * destroy MM + */ +void mmDestroy( memHeap_t *mmInit ); + +/* For debuging purpose. */ +void mmDumpMemInfo( memHeap_t *mmInit ); + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c new file mode 100644 index 000000000..e722b8bd3 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c @@ -0,0 +1,276 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c,v 1.2 2000/08/04 03:51:48 tsi Exp $ */ + +#define __NO_VERSION__ +#include <linux/fb.h> +#include <linux/sisfb.h> +#include <linux/interrupt.h> + +#include "drmP.h" +#include "sis_drm_public.h" +#include "sis_ds.h" +#include "sis_drv.h" + +#define MAX_CONTEXT 100 +#define VIDEO_TYPE 0 +#define AGP_TYPE 1 + +typedef struct { + int used; + int context; + set_t *sets[2]; /* 0 for video, 1 for AGP */ +} sis_context_t; + +static sis_context_t global_ppriv[MAX_CONTEXT]; + +static int add_alloc_set(int context, int type, unsigned int val) +{ + int i, retval = 0; + + for(i = 0; i < MAX_CONTEXT; i++) + if(global_ppriv[i].used && global_ppriv[i].context == context){ + retval = setAdd(global_ppriv[i].sets[type], val); + break; + } + return retval; +} + +static int del_alloc_set(int context, int type, unsigned int val) +{ + int i, retval = 0; + for(i = 0; i < MAX_CONTEXT; i++) + if(global_ppriv[i].used && global_ppriv[i].context == context){ + retval = setDel(global_ppriv[i].sets[type], val); + break; + } + return retval; +} + +/* fb management via fb device */ +#if 1 +int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_sis_mem_t fb; + struct sis_memreq req; + int retval = 0; + + copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT); + + req.size = fb.size; + sis_malloc(&req); + if(req.offset){ + /* TODO */ + fb.offset = req.offset; + fb.free = req.offset; + if(!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)){ + DRM_DEBUG("adding to allocation set fails"); + sis_free(req.offset); + retval = -1; + } + } + else{ + fb.offset = 0; + fb.size = 0; + fb.free = 0; + } + + copy_to_user_ret((drm_sis_mem_t *)arg, &fb, sizeof(fb), -EFAULT); + + DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); + + return retval; +} + +int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_sis_mem_t fb; + int retval = 0; + + copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT); + + if(!fb.free){ + return -1; + } + + sis_free(fb.free); + if(!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) + retval = -1; + + DRM_DEBUG("free fb, offset = %d\n", fb.free); + + return retval; +} + +#else + +int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + return -1; +} + +int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + return 0; +} + +#endif + +/* agp memory management */ +#if 1 + +static memHeap_t *AgpHeap = NULL; + +int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_sis_agp_t agp; + + copy_from_user_ret(&agp, (drm_sis_agp_t *)arg, sizeof(agp), -EFAULT); + + AgpHeap = mmInit(agp.offset, agp.size); + + DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size); + + return 0; +} + +int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_sis_mem_t agp; + PMemBlock block; + int retval = 0; + + if(!AgpHeap) + return -1; + + copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT); + + block = mmAllocMem(AgpHeap, agp.size, 0, 0); + if(block){ + /* TODO */ + agp.offset = block->ofs; + agp.free = (unsigned int)block; + if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){ + DRM_DEBUG("adding to allocation set fails"); + mmFreeMem((PMemBlock)agp.free); + retval = -1; + } + } + else{ + agp.offset = 0; + agp.size = 0; + agp.free = 0; + } + + copy_to_user_ret((drm_sis_mem_t *)arg, &agp, sizeof(agp), -EFAULT); + + DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset); + + return retval; +} + +int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_sis_mem_t agp; + int retval = 0; + + if(!AgpHeap) + return -1; + + copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT); + + if(!agp.free){ + return -1; + } + + mmFreeMem((PMemBlock)agp.free); + if(!del_alloc_set(agp.context, AGP_TYPE, agp.free)) + retval = -1; + + DRM_DEBUG("free agp, free = %d\n", agp.free); + + return retval; +} + +#endif + +int sis_init_context(int context) +{ + int i; + + for(i = 0; i < MAX_CONTEXT ; i++) + if(global_ppriv[i].used && (global_ppriv[i].context == context)) + break; + + if(i >= MAX_CONTEXT){ + for(i = 0; i < MAX_CONTEXT ; i++){ + if(!global_ppriv[i].used){ + global_ppriv[i].context = context; + global_ppriv[i].used = 1; + global_ppriv[i].sets[0] = setInit(); + global_ppriv[i].sets[1] = setInit(); + DRM_DEBUG("init allocation set, socket=%d, context = %d\n", + i, context); + break; + } + } + if((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) || + (global_ppriv[i].sets[1] == NULL)){ + return 0; + } + } + + return 1; +} + +int sis_final_context(int context) +{ + int i; + + for(i=0; i<MAX_CONTEXT; i++) + if(global_ppriv[i].used && (global_ppriv[i].context == context)) + break; + + if(i < MAX_CONTEXT){ + set_t *set; + unsigned int item; + int retval; + + DRM_DEBUG("find socket %d, context = %d\n", i, context); + + /* Video Memory */ + set = global_ppriv[i].sets[0]; + retval = setFirst(set, &item); + while(retval){ + DRM_DEBUG("free video memory 0x%x\n", item); + sis_free(item); + retval = setNext(set, &item); + } + setDestroy(set); + + /* AGP Memory */ + set = global_ppriv[i].sets[1]; + retval = setFirst(set, &item); + while(retval){ + DRM_DEBUG("free agp memory 0x%x\n", item); + mmFreeMem((PMemBlock)item); + retval = setNext(set, &item); + } + setDestroy(set); + + global_ppriv[i].used = 0; + } + + /* turn-off auto-flip */ + /* TODO */ +#if defined(SIS_STEREO) + flip_final(); +#endif + + return 1; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c index e4bc53bc3..10c2222cc 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c @@ -27,7 +27,7 @@ * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.14 2000/06/27 16:42:07 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.15 2000/08/09 14:44:27 alanh Exp $ * */ @@ -71,8 +71,6 @@ extern int xf86RemoveSIGIOHandler(int fd); #ifdef __alpha__ extern unsigned long _bus_base(void); #define BUS_BASE _bus_base() -#else -#define BUS_BASE (0) #endif /* Not all systems have MAP_FAILED defined */ @@ -504,7 +502,7 @@ int drmAddMap(int fd, map.offset = offset; #ifdef __alpha__ - if (!(type & DRM_SHM)) + if (type != DRM_SHM) map.offset += BUS_BASE; #endif map.size = size; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile index de4314ef0..42026b33d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.10 2000/03/31 22:55:54 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.11 2000/08/09 02:33:49 tsi Exp $ #define IHaveModules @@ -29,7 +29,7 @@ DEFINES=-DHAVE_SYSV_IPC #define X86EMU_LIBPATH /usr/local/lib #endif -#if defined(i386Architecture) +#if defined(i386Architecture) || defined(ia64Architecture) DEFINES =-D_PC #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c index 820ad7805..71cbf4bcf 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.11 2000/05/31 07:15:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.14 2000/07/21 21:04:05 tsi Exp $ */ /* * linux specific part of the int10 module * Copyright 1999 Egbert Eich @@ -113,14 +113,18 @@ xf86InitInt10(int entityIndex) pInt->private = (pointer)xnfcalloc(1,sizeof(linuxInt10Priv)); ((linuxInt10Priv*)pInt->private)->screen = screen; ((linuxInt10Priv*)pInt->private)->alloc = - (pointer)xnfcalloc(1,sizeof(ALLOC_ENTRIES(pagesize))); + (pointer)xnfcalloc(1,ALLOC_ENTRIES(pagesize)); #ifdef DEBUG ErrorF("Mapping high memory area\n"); #endif if ((high_mem = shmget(counter++, HIGH_MEM_SIZE, - IPC_CREAT | SHM_R | SHM_W)) == -1) + IPC_CREAT | SHM_R | SHM_W)) == -1) { + if (errno == ENOSYS) + xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure" + " your kernel to include System V IPC support\n"); goto error1; + } ((linuxInt10Priv*)pInt->private)->highMem = high_mem; #ifdef DEBUG ErrorF("Mapping 640kB area\n"); @@ -158,7 +162,7 @@ xf86InitInt10(int entityIndex) CARD8 *bios_base = (unsigned char *)(cs << 4); if (!int10_read_bios(screen,cs,bios_base)) { - int cs = ((CARD16*)0)[(0x42<<1)+1]; + cs = ((CARD16*)0)[(0x42<<1)+1]; bios_base = (unsigned char *)(cs << 4); if (!int10_read_bios(screen,cs,bios_base)) { cs = V_BIOS >> 4; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c index 17d215ad0..2daf3b714 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.4 1998/08/29 05:43:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.5 2000/07/31 23:25:18 tsi Exp $ */ /* * Copyright 1998 by Metro Link Incorporated * @@ -79,7 +79,7 @@ outw(unsigned short port, unsigned short value) } void -outl(unsigned short port, unsigned long value) +outl(unsigned short port, unsigned int value) { stl_brx(value, ioBase, port); eieio(); } @@ -102,10 +102,10 @@ inw(unsigned short port) return(val); } -unsigned long +unsigned int inl(unsigned short port) { - unsigned long val; + unsigned int val; val = ldl_brx(ioBase, port); eieio(); return(val); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c b/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c new file mode 100644 index 000000000..04fe5b0b5 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c @@ -0,0 +1,28 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.1 2000/08/04 16:13:41 eich Exp $ */ + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include <time.h> + +void +xf86UDelay(long usec) +{ + struct timeval start, interrupt; + + gettimeofday(&start,NULL); + + do { + usleep(usec); + gettimeofday(&interrupt,NULL); + + if ((usec = usec - (interrupt.tv_sec - start.tv_sec) * 1000000 + - (interrupt.tv_usec - start.tv_usec)) < 0) + break; + + } while (1); + +} + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c b/xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c index 66ba66a40..57176c5d5 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c @@ -4,7 +4,7 @@ Stub for Alpha Linux *******************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c,v 1.2 1998/07/25 16:56:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c,v 1.3 2000/08/04 16:13:41 eich Exp $ */ #include "X.h" #include "xf86.h" @@ -19,5 +19,6 @@ void xf86IODelay() { - usleep(1); + xf86UDelay(1); } + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile index 0d4bc8293..3fb7ba9fb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.7 2000/02/15 23:44:58 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.9 2000/08/10 17:40:36 dawes Exp $ @@ -8,7 +8,7 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:12 rws $ #include <Server.tmpl> -#if defined(i386Architecture) +#if defined(i386Architecture) && !defined(cygwinArchitecture) XSRCS = BUSmemcpy.S IODelay.S SlowBcopy.S XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o #elif defined(SparcArchitecture) @@ -24,9 +24,9 @@ ILHACKSRCS = xf86_IlHack.c ILHACKOBJS = xf86_IlHack.o #endif -SRCS = xf86_Util.c $(ILHACKSRCS) $(XSRCS) +SRCS = xf86_Util.c Delay.c $(ILHACKSRCS) $(XSRCS) -OBJS = xf86_Util.o $(ILHACKOBJS) $(XOBJS) +OBJS = xf86_Util.o Delay.o $(ILHACKOBJS) $(XOBJS) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -34,7 +34,7 @@ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() -#if defined(i386Architecture) +#if defined(i386Architecture) && !defined(cygwinArchitecture) ObjectFromAsmSource(BUSmemcpy,NullParameter) ObjectFromAsmSource(IODelay,NullParameter) ObjectFromAsmSource(SlowBcopy,NullParameter) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c b/xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c index 6a7610d36..297ce45ea 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.1 2000/04/05 18:13:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.2 2000/07/13 21:31:40 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -140,10 +140,6 @@ xf86DrvMsg(screen,X_INFO,"%s\n",buf); xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (2)\n"); goto error1; } - if (bios_checksum(vbiosMem,size)) { - xf86DrvMsg(screen,X_ERROR,"Bad checksum of V_BIOS \n"); - goto error1; - } setupTable(pInt,(memType)vbiosMem,cs<<4,size); set_return_trap(pInt); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c index daa0446d2..c01091164 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c,v 1.4 1999/01/14 13:05:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c,v 1.5 2000/07/31 23:24:32 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -538,15 +538,12 @@ nh6400PciReadLong(PCITAG tag, int offset) "nh6400PciReadLong: Writing cfgaddr=0x%x to 0x%x (phys=0x%x)\n", cfgaddr, base, infop->cfgPhysBase); + /* There may not be any OS interaction while interrupts are disabled */ xf86DisableInterrupts(); *((unsigned long *)(base)) = pciByteSwap(cfgaddr); /* Set cfg address */ eieio(); - xf86MsgVerb(X_INFO, 3, - "nh6400PciReadLong: About to read from 0x%x (phys=0x%x)\n", - base + data_reg_offset, infop->cfgPhysBase + data_reg_offset); - if (!badaddr(base + data_reg_offset, 4, 0)) { tmp = *((unsigned long *)(base + data_reg_offset)); eieio(); @@ -554,8 +551,8 @@ nh6400PciReadLong(PCITAG tag, int offset) xf86EnableInterrupts(); - xf86MsgVerb(X_INFO, 3, "nh6400PciReadLong: Read value=0x%x\n", - pciByteSwap(tmp)); + xf86MsgVerb(X_INFO, 3, "nh6400PciReadLong: Read value=0x%x from 0x%x (phys=0x%x)\n", + pciByteSwap(tmp), base + data_reg_offset, infop->cfgPhysBase + data_reg_offset); return(pciByteSwap(tmp)); } @@ -645,20 +642,21 @@ nh6400PciWriteLong(PCITAG tag, int offset, unsigned long val) "nh6400PciWriteLong: Writing cfgaddr=0x%x to 0x%x (phys=0x%x)\n", cfgaddr, base, infop->cfgPhysBase); + /* There may not be any OS interaction while interrupts are disabled */ xf86DisableInterrupts(); *((unsigned long *)(base)) = pciByteSwap(cfgaddr); /* Set cfg address */ eieio(); - xf86MsgVerb(X_INFO, 3, - "nh6400PciWriteLong: Writing value=0x%x to 0x%x (phys=0x%x)\n", - val, base + data_reg_offset, - infop->cfgPhysBase + data_reg_offset); - *((unsigned long *)(base + data_reg_offset)) = pciByteSwap(val); eieio(); xf86EnableInterrupts(); + + xf86MsgVerb(X_INFO, 3, + "nh6400PciWriteLong: Wrote value=0x%x to 0x%x (phys=0x%x)\n", + val, base + data_reg_offset, + infop->cfgPhysBase + data_reg_offset); } /* @@ -844,16 +842,12 @@ nh6408PciReadLong(PCITAG tag, int offset) "nh6408PciReadLong: Writing cfgaddr=0x%x to 0x%x (phys=0x%x)\n", cfgaddr, base, infop->cfgPhysBase); + /* There may not be any OS interaction while interrupts are disabled */ xf86DisableInterrupts(); *((unsigned long *)(base)) = pciByteSwap(cfgaddr); /* Set cfg address */ eieio(); - xf86MsgVerb(X_INFO, 3, - "nh6408PciReadLong: About to read from 0x%x (phys=0x%x)\n", - base + NH6408_PCI_CFG_DATA_REG_OFF, - infop->cfgPhysBase + NH6408_PCI_CFG_DATA_REG_OFF); - if (!badaddr(base + NH6408_PCI_CFG_DATA_REG_OFF, 4, 0)) { tmp = *((unsigned long *)(base + NH6408_PCI_CFG_DATA_REG_OFF)); eieio(); @@ -861,8 +855,10 @@ nh6408PciReadLong(PCITAG tag, int offset) xf86EnableInterrupts(); - xf86MsgVerb(X_INFO, 3, "nh6408PciReadLong: Read value=0x%x\n", - pciByteSwap(tmp)); + xf86MsgVerb(X_INFO, 3, "nh6408PciReadLong: Read value=0x%x from 0x%x (phys=0x%x)\n", + pciByteSwap(tmp), + base + NH6408_PCI_CFG_DATA_REG_OFF, + infop->cfgPhysBase + NH6408_PCI_CFG_DATA_REG_OFF); return(pciByteSwap(tmp)); } @@ -951,21 +947,21 @@ nh6408PciWriteLong(PCITAG tag, int offset, unsigned long val) "nh6408PciWriteLong: Writing cfgaddr=0x%x to 0x%x (phys=0x%x)\n", cfgaddr, base, infop->cfgPhysBase); + /* There may not be any OS interaction while interrupts are disabled */ xf86DisableInterrupts(); *((unsigned long *)(base)) = pciByteSwap(cfgaddr); /* Set cfg address */ eieio(); - xf86MsgVerb(X_INFO, 3, - "nh6408PciWriteLong: Writing value=0x%x to 0x%x (phys=0x%x)\n", - val, base + NH6408_PCI_CFG_DATA_REG_OFF, - infop->cfgPhysBase + NH6408_PCI_CFG_DATA_REG_OFF); - - *((unsigned long *)(base + NH6408_PCI_CFG_DATA_REG_OFF)) = pciByteSwap(val); eieio(); xf86EnableInterrupts(); + + xf86MsgVerb(X_INFO, 3, + "nh6408PciWriteLong: Wrote value=0x%x to 0x%x (phys=0x%x)\n", + val, base + NH6408_PCI_CFG_DATA_REG_OFF, + infop->cfgPhysBase + NH6408_PCI_CFG_DATA_REG_OFF); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c index 886d68133..c442f14d4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c,v 1.3 1998/07/25 16:56:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c,v 1.4 2000/07/31 23:25:18 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -90,7 +90,7 @@ outw(unsigned int a, unsigned short w) } void -outl(unsigned int a, unsigned long l) +outl(unsigned int a, unsigned int l) { if (ioBase == MAP_FAILED) { ErrorF("outl(0x%04X, 0x%08X) fails. Unitialized ioBase\n", a, l); @@ -129,10 +129,10 @@ inw(unsigned int a) return(w); } -unsigned long +unsigned int inl(unsigned int a) { - unsigned long l; + unsigned int l; if (ioBase == MAP_FAILED) { FatalError("%s(0x%04X) fails. Unitialized ioBase\n", "inl", a); @@ -164,7 +164,7 @@ debug_outw(unsigned int a, unsigned short w, int line, char *file) } void -debug_outl(unsigned int a, unsigned long l, int line, char *file) +debug_outl(unsigned int a, unsigned int l, int line, char *file) { if (xf86Verbose > 3) ErrorF("outl(0x%04X, 0x%08X) at line %d, file \"%s\"\n", a, l, line, file); @@ -205,10 +205,10 @@ debug_inw(unsigned int a, int line, char *file) return(w); } -unsigned long +unsigned int debug_inl(unsigned int a, int line, char *file) { - unsigned long l; + unsigned int l; if (xf86Verbose > 4) ErrorF("Calling %s(0x%04x) at line %d, file \"%s\" ...\n", "inl", a, line, file); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index 4affcc415..5a979e1cb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -353,6 +353,8 @@ typedef struct drm_agp_info { #define DRM_IOCTL_I810_GETAGE DRM_IO ( 0x44) #define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) #define DRM_IOCTL_I810_SWAP DRM_IO ( 0x46) +#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO ( 0x48) /* Rage 128 specific ioctls */ #define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c index b509b7883..1af33de8f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.65 2000/06/17 00:03:42 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.67 2000/08/10 17:40:36 dawes Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * @@ -76,6 +76,11 @@ extern int mmapFd; #include <stdlib.h> #endif +#ifdef __CYGWIN__ +#define vsscanf sscanf +#define vfscanf fscanf +#endif + #define NEED_XF86_TYPES #define DONT_DEFINE_WRAPPERS #include "xf86_ansic.h" @@ -391,7 +396,7 @@ xf86open(const char *path, int flags, ...) va_start(ap, flags); flags = xfToOsOpenFlags(flags); - if (flags & XF86_O_CREAT) { + if (flags & O_CREAT) { mode_t mode = va_arg(ap, mode_t); fd = open(path, flags, mode); } else { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c index c6f5e9b5d..fb71e4f33 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.11 2000/05/03 00:44:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.12 2000/07/11 01:46:37 tsi Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc * @@ -46,13 +46,18 @@ static int vidMapIndex = -1; #define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr)) static VidMemInfo vidMemInfo = {FALSE, }; +static VidMapRec vidMapRec = {0, NULL, TRUE, X_DEFAULT, FALSE, NULL}; static VidMapPtr getVidMapRec(int scrnIndex) { VidMapPtr vp; + ScrnInfoPtr pScrn; + + if ((scrnIndex < 0) || + !(pScrn = xf86Screens[scrnIndex])) + return &vidMapRec; - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; if (vidMapIndex < 0) vidMapIndex = xf86AllocateScrnInfoPrivateIndex(); @@ -118,7 +123,7 @@ static OptionInfoRec opts[] = static void checkMtrrOption(VidMapPtr vp) { - if (!vp->mtrrOptChecked && vp->pScrn->options != NULL) { + if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) { OptionInfoRec options[nopts]; (void)memcpy(options, opts, sizeof(opts)); @@ -139,7 +144,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) if (((Flags & VIDMEM_FRAMEBUFFER) && (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) - FatalError("Mapping memory with more than one type"); + FatalError("Mapping memory with more than one type\n"); if (!vidMemInfo.initialised) { memset(&vidMemInfo, 0, sizeof(VidMemInfo)); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile index 97005bf4d..873b5deb9 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.5 2000/06/17 00:03:43 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.6 2000/08/11 19:51:04 dawes Exp $ @@ -33,7 +33,7 @@ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ RESDEFINES = -DUSESTDRES -DEFINES = $(RESDEFINES) -DSOL8 +DEFINES = $(RESDEFINES) SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c index ed6f0363a..dc6eeeb91 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c,v 1.2 1999/10/13 04:21:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c,v 1.3 2000/08/11 19:51:04 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -50,7 +50,7 @@ char fb_dev[PATH_MAX] = "/dev/console"; #define MAX_SECONDS 60 #define USEC_IN_SEC (unsigned long)1000000 -#ifndef SOL8 +#ifndef __SOL8__ int xf86_sol8usleep(unsigned long); static void xf86_sol8sleep(int); #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c index cc067165c..84639a593 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.9 2000/05/31 09:39:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.12 2000/08/04 16:13:41 eich Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -38,13 +38,14 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex) int screen = pScrn->scrnIndex; if (!pInt) { - if (xf86LoadSubModule(pScrn, "int10")) { - xf86DrvMsg(screen,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(entityIndex); - if (!pInt) - goto error; - init_int10 = TRUE; - } + if (!xf86LoadSubModule(pScrn, "int10")) + goto error; + + xf86DrvMsg(screen,X_INFO,"initializing int10\n"); + pInt = xf86InitInt10(entityIndex); + if (!pInt) + goto error; + init_int10 = TRUE; } page = xf86Int10AllocPages(pInt,1,&RealOff); @@ -118,6 +119,9 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex) void vbeFree(vbeInfoPtr pVbe) { + if (!pVbe) + return; + xf86Int10FreePages(pVbe->pInt10,pVbe->memory,pVbe->num_pages); /* If we have initalized int10 we ought to free it, too */ if (pVbe->init_int10) @@ -156,19 +160,19 @@ vbeProbeDDC(vbeInfoPtr pVbe) xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n"); switch (pVbe->pInt10->bx & 0x3) { case 0: - ddc_level = "none"; + ddc_level = " none"; pVbe->ddc = DDC_NONE; break; case 1: - ddc_level = " 1 "; + ddc_level = " 1"; pVbe->ddc = DDC_1; break; case 2: - ddc_level = " 2 "; + ddc_level = " 2"; pVbe->ddc = DDC_2; break; case 3: - ddc_level = " 1 + 2 "; + ddc_level = " 1 + 2"; pVbe->ddc = DDC_1_2; break; default: @@ -176,7 +180,7 @@ vbeProbeDDC(vbeInfoPtr pVbe) pVbe->ddc = DDC_NONE; break; } - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level %s\n",ddc_level); + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level%s\n",ddc_level); if (pVbe->pInt10->bx & 0x4) { xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked" "for data transfer\n"); @@ -281,3 +285,20 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) xf86UnloadSubModule(pModule); return pMonitor; } + + +Bool +vbeModeInit(vbeInfoPtr pVbe, int mode) +{ + pVbe->pInt10->ax = 0x4F02; + pVbe->pInt10->bx = mode | (1 << 14); + xf86ExecX86int10(pVbe->pInt10); + + if ((pVbe->pInt10->ax & 0xff) != 0x4f) + return FALSE; + + return TRUE; + +} + + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h index 85bec091b..bc661f1f4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.9 2000/04/17 16:30:12 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.10 2000/08/08 08:58:08 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -99,6 +99,7 @@ typedef struct _MouseDevRec { const char * mseDevice; const char * protocol; int protocolID; + int oldProtocolID; /* hack */ int class; int mseModel; int baudRate; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h index 913258dd7..e50fda668 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.72 2000/06/23 22:42:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.74 2000/08/11 19:51:04 dawes Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -112,7 +112,7 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); /**************************************************************************/ /* SYSV386 (SVR3, SVR4) - But not Solaris8 */ /**************************************************************************/ -#if (defined(SYSV) || defined(SVR4)) && !defined(DGUX) && !defined(SOL8) +#if (defined(SYSV) || defined(SVR4)) && !defined(DGUX) && !defined(__SOL8__) # ifdef SCO325 # ifndef _SVID3 # define _SVID3 @@ -266,7 +266,7 @@ extern int xf86_solx86usleep(unsigned long); * Good ol' Solaris8, and its lack of VT support ***********/ -#ifdef SOL8 +#ifdef __SOL8__ #include <sys/mman.h> #include <errno.h> #include <sys/sysi86.h> @@ -282,7 +282,7 @@ extern int xf86_solx86usleep(unsigned long); #include <signal.h> -#endif /* SOL8 */ +#endif /* __SOL8__ */ @@ -773,6 +773,49 @@ extern char* __XOS2RedirRoot(char*); #endif /* __GNU__ */ /**************************************************************************/ +/* Cygwin */ +/**************************************************************************/ +#if defined(__CYGWIN__) +#include <signal.h> +#include <errno.h> +#include <sys/stat.h> +#include <termios.h> +#include <sys/ioctl.h> +#include <sys/param.h> + +/* Warning: by default, the fd_set size is 32 in QNX! */ +#define FD_SETSIZE 256 +#include <sys/select.h> + + /* keyboard types */ +# define KB_84 1 +# define KB_101 2 +# define KB_OTHER 3 + + /* LEDs */ +# define LED_CAP 0x04 +# define LED_NUM 0x02 +# define LED_SCR 0x01 + +# define POSIX_TTY +# define OSMOUSE_ONLY +# define MOUSE_PROTOCOL_IN_KERNEL + +#define TIOCM_DTR 0x0001 /* data terminal ready */ +#define TIOCM_RTS 0x0002 /* request to send */ +#define TIOCM_CTS 0x1000 /* clear to send */ +#define TIOCM_DSR 0x2000 /* data set ready */ +#define TIOCM_RI 0x4000 /* ring */ +#define TIOCM_RNG TIOCM_RI +#define TIOCM_CD 0x8000 /* carrier detect */ +#define TIOCM_CAR TIOCM_CD +#define TIOCM_LE 0x0100 /* line enable */ +#define TIOCM_ST 0x0200 /* secondary transmit */ +#define TIOCM_SR 0x0400 /* secondary receive */ +#endif /* __CYGWIN__ */ + + +/**************************************************************************/ /* Generic */ /**************************************************************************/ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h index fcfc32024..8816c4ea1 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h @@ -64,7 +64,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.42 2000/06/24 17:23:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.43 2000/08/04 16:13:39 eich Exp $ */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H @@ -150,6 +150,7 @@ extern void xf86SetRGBOut(void); extern void xf86BusToMem(unsigned char *, unsigned char *, int); extern void xf86MemToBus(unsigned char *, unsigned char *, int); extern void xf86IODelay(void); +extern void xf86UDelay(long usec); extern void xf86SlowBcopy(unsigned char *, unsigned char *, int); extern int xf86OpenSerial(pointer options); extern int xf86SetSerial(int fd, pointer options); diff --git a/xc/programs/Xserver/hw/xfree86/parser/Flags.c b/xc/programs/Xserver/hw/xfree86/parser/Flags.c index 6fd8df099..66f5f80fc 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Flags.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Flags.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.12 2000/04/04 22:36:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.13 2000/08/08 08:58:08 eich Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -194,22 +194,24 @@ printServerFlagsSection (FILE * f, XF86ConfFlagsPtr flags) static XF86OptionPtr addNewOption2 (XF86OptionPtr head, char *name, char *val, int used) { - XF86OptionPtr new, old = NULL; + XF86OptionPtr new, old = NULL; /* Don't allow duplicates */ - if (head != NULL && (old = FindOption(head, name)) != NULL) - new = old; - else - new = xf86confcalloc (1, sizeof (XF86OptionRec)); - new->opt_name = name; - new->opt_val = val; - new->opt_used = used; - new->list.next = NULL; - - if (old == NULL) - return ((XF86OptionPtr) addListItem ((glp) head, (glp) new)); - else - return head; + if (head != NULL && (old = FindOption(head, name)) != NULL) + new = old; + else { + new = xf86confcalloc (1, sizeof (XF86OptionRec)); + new->list.next = NULL; + } + + new->opt_name = name; + new->opt_val = val; + new->opt_used = used; + + if (old == NULL) + return ((XF86OptionPtr) addListItem ((glp) head, (glp) new)); + else + return head; } XF86OptionPtr @@ -447,3 +449,12 @@ ULongToString(unsigned long i) return s; } +void +DebugListOptions(XF86OptionPtr Options) +{ + while (Options) { + ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val); + Options = Options->list.next; + } +} + diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c b/xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c index 0f94bf9b7..3b01081df 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c +++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c @@ -23,17 +23,17 @@ * * Generic RAMDAC access to colormaps. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c,v 1.6 2000/03/21 21:15:28 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86RamDacCmap.c,v 1.7 2000/07/26 01:52:24 tsi Exp $ */ #include "X.h" #include "Xproto.h" #include "windowstr.h" -#include "compiler.h" #include "mipointer.h" #include "micmap.h" #include "xf86.h" #include "xf86_ansic.h" +#include "compiler.h" #include "colormapst.h" #include "xf86RamDacPriv.h" diff --git a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c index 89fd901f1..baa0298bb 100644 --- a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c +++ b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.36 2000/02/21 19:23:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.40 2000/08/11 17:27:17 dawes Exp $ */ /* * @@ -17,28 +17,20 @@ #include "X.h" #include "misc.h" -#include "compiler.h" - #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "vgaHW.h" -#include "xf86cmap.h" - -/* - * XXX The PC98 bits have been removed for now. The structure of the - * code here has been reorganised to the point where they need to be - * redone anyway. In the meantime the older version can be found in - * xfree86/olddrivers/vgahw/. - */ +#include "compiler.h" +#include "xf86cmap.h" #ifndef SAVE_FONT1 #define SAVE_FONT1 #endif -#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) +#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun) #ifndef NEED_SAVED_CMAP #define NEED_SAVED_CMAP #endif @@ -1078,11 +1070,12 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save) #endif hwp->writeDacMask(hwp, 0xFF); + /* * check if we can read the lookup table */ hwp->writeDacReadAddr(hwp, 0x00); - for (i = 0; i < 3; i++) { + for (i = 0; i < 6; i++) { save->DAC[i] = hwp->readDacData(hwp); #ifdef DEBUG switch (i % 3) { @@ -1097,15 +1090,23 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save) } #endif } - hwp->writeDacWriteAddr(hwp, 0x00); - for (i = 0; i < 3; i++) + + /* + * Check if we can read the palette - + * use foreground color to prevent flashing. + */ + hwp->writeDacWriteAddr(hwp, 0x01); + for (i = 3; i < 6; i++) hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK); - hwp->writeDacReadAddr(hwp, 0x00); - for (i = 0; i < 3; i++) { + hwp->writeDacReadAddr(hwp, 0x01); + for (i = 3; i < 6; i++) { if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK)) readError = TRUE; } - + hwp->writeDacWriteAddr(hwp, 0x01); + for (i = 3; i < 6; i++) + hwp->writeDacData(hwp, save->DAC[i]); + if (readError) { /* * save the default lookup table @@ -1115,7 +1116,7 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save) "Cannot read colourmap from VGA. Will restore with default\n"); } else { /* save the colourmap */ - hwp->writeDacReadAddr(hwp, 0x01); + hwp->writeDacReadAddr(hwp, 0x02); for (i = 3; i < 768; i++) { save->DAC[i] = hwp->readDacData(hwp); DACDelay(hwp); @@ -1133,6 +1134,7 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save) #endif } } + hwp->disablePalette(hwp); hwp->cmapSaved = TRUE; #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h b/xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h index 63ad85a8b..3891f1e21 100644 --- a/xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h +++ b/xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h,v 1.3 1999/01/31 12:22:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/OScompiler.h,v 1.4 2000/07/26 01:52:26 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -32,9 +32,7 @@ #define ABS(x) (((x)>0)?(x):-(x)) #include "misc.h" -#ifdef XFree86LOADER #include "xf86_ansic.h" -#endif #include "compiler.h" #ifdef lint diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h index c3b6288c1..987be2ec5 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86Version.h +++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h @@ -1,13 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.441 2000/07/02 02:35:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.443 2000/08/09 23:40:16 dawes Exp $ */ -#define XF86_VERSION " 4.0.1 " +#define XF86_VERSION " 4.0.1b " /* The finer points in versions... */ #define XF86_VERSION_MAJOR 4 #define XF86_VERSION_MINOR 0 #define XF86_VERSION_SUBMINOR 1 #define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */ -#define XF86_VERSION_ALPHA 0 /* 0="", 1="a", 2="b", etc... */ +#define XF86_VERSION_ALPHA 2 /* 0="", 1="a", 2="b", etc... */ #define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \ ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha) @@ -18,6 +18,6 @@ XF86_VERSION_BETA, \ XF86_VERSION_ALPHA) -#define XF86_DATE "1 July 2000" +#define XF86_DATE "11 August 2000" /* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad index 91c4872e5..2ef449bbd 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad @@ -26,7 +26,7 @@ !! !! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> !! -!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.3 2000/06/13 23:15:51 dawes Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.4 2000/08/01 20:05:43 dawes Exp $ !! *Form.background: gray85 @@ -815,6 +815,8 @@ your monitor is not rotated. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! accessx !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +*Accessx*Label.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1 +*Accessx.Form.Toggle.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1 *Accessx*Label.background: white *Accessx*Label.justify: left *Accessx*Label.internalHeight: 0 @@ -837,7 +839,7 @@ fill-poly 0,2,0,-3,8,6 <Enter>: set-values(1, displayList, "foreground white;points 0,0,-1,0;fill-poly 0,1,10,6,0,-2;foreground rgb:7/7/f;fill-poly 0,2,0,-3,8,6")\n\ <Leave>: set-values(1, displayList, "foreground white;points 0,0,-1,0;foreground rgb:f/7/7;fill-poly 0,2,0,-3,8,6") *Accessx.Form.borderWidth: 1 -*Accessx.Form.borderColor: rgb:f/7/7 +*Accessx.Form.borderColor: rgb:f/a/a *Accessx.Form.vertDistance: 0 *Accessx.Form.defaultDistance: 2 *Accessx.borderWidth: 0 @@ -894,7 +896,7 @@ lines -1,0,0,0,0,-1 *Accessx*Scrollbar.height: 8 *Accessx*Scrollbar.minimumThumb: 5 *Accessx*Scrollbar.borderWidth: 1 -*Accessx*Scrollbar.borderColor: gray70 +*Accessx*Scrollbar.borderColor: white *Accessx*Scrollbar.foreground: rgb:f/7/7 *Accessx*Scrollbar.background: gray95 *Accessx*Scrollbar.displayList:\ @@ -938,6 +940,9 @@ lines -1,0,0,0,0,-1 *Accessx.mouseForm.timeScroller.horizDistance: 37 *Accessx.mouseForm.delayLabel.fromVert: timeScroller *Accessx.mouseForm.delayLabel.label: Motion delay (sec) +*Accessx.mouseForm.delayLabel.tip:\ +Time between the initial key press\n\ +and the first repeated motion event *Accessx.mouseForm.delayLabel.vertDistance: 7 *Accessx.mouseForm.delayNumber.label: ??? *Accessx.mouseForm.delayNumber.fromVert: timeScroller @@ -981,6 +986,7 @@ lines -1,0,0,0,0,-1 *Accessx.slowForm.Toggle.internalWidth: 4 *Accessx.slowForm.Toggle.internalHeight: 1 *Accessx.slowForm.beep.label: Beep when key is +*Accessx.slowForm.beep.vertDistance: 3 *Accessx.slowForm.pressed.fromHoriz: beep *Accessx.slowForm.pressed.label: pressed *Accessx.slowForm.accepted.fromHoriz: pressed diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c index fc2f41c16..3a5557fe8 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.4 2000/06/20 05:08:50 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.5 2000/08/01 20:05:43 dawes Exp $ */ #include "config.h" @@ -82,6 +82,7 @@ static void ScaleEnableCallback(Widget, XtPointer, XtPointer); static void ScaleJumpCallback(Widget, XtPointer, XtPointer); static void ApplyCallback(Widget, XtPointer, XtPointer); +static void AccessXInitialize(void); /* * Implementation @@ -90,10 +91,12 @@ void startaccessx(void) { InitializeKeyboard(); + XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); if (xkb_info->xkb->ctrls == NULL) xkb_info->xkb->ctrls = (XkbControlsPtr) XtCalloc(1, sizeof(XkbControlsRec)); + xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | XkbMouseKeysAccelMask; xkb_info->xkb->ctrls->mk_delay = 40; @@ -153,7 +156,7 @@ AccessXInitialize(void) Arg args[1]; Boolean state; Widget stickyForm, mouseForm, repeatForm, slowForm, bounceForm; - float val; + float val, tmp; if (!first) return; @@ -380,20 +383,21 @@ AccessXInitialize(void) XtSetArg(args[0], XtNstate, &state); XtGetValues(mouse, args, 1); EnableCallback(mouse, (XtPointer)mouseForm, (XtPointer)(int)state); - if (xkb_info->xkb->ctrls->mk_interval > 10) - val = (float)(xkb_info->xkb->ctrls->mk_interval - 10) / - (float)MAX_MOUSE_SPEED; - else - val = 10.0 / (float)MAX_MOUSE_SPEED; - ScaleJumpCallback(mouseSpeed->scroller, (XtPointer)mouseSpeed, - (XtPointer)&val); if (xkb_info->xkb->ctrls->mk_time_to_max > 10) - val = (float)(xkb_info->xkb->ctrls->mk_time_to_max - 10) / + val = (float)((xkb_info->xkb->ctrls->mk_time_to_max * (40. / 10.))) / (float)(MAX_MOUSE_TIME * 100); else val = 10.0 / (float)(MAX_MOUSE_TIME * 100); ScaleJumpCallback(mouseTime->scroller, (XtPointer)mouseTime, (XtPointer)&val); + tmp = mouseTime->value; + if (xkb_info->xkb->ctrls->mk_max_speed != 0) + val = (float)(xkb_info->xkb->ctrls->mk_max_speed / tmp - 10) / + (float)MAX_MOUSE_SPEED; + else + val = 10.0 / (float)MAX_MOUSE_SPEED; + ScaleJumpCallback(mouseSpeed->scroller, (XtPointer)mouseSpeed, + (XtPointer)&val); if (xkb_info->xkb->ctrls->mk_delay > 10) val = (float)(xkb_info->xkb->ctrls->mk_delay - 10) / (float)(MAX_MOUSE_DELAY * 100); @@ -584,13 +588,16 @@ ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | XkbMouseKeysAccelMask; xkb_info->config.mk_delay = - xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100; + xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100; xkb_info->config.mk_interval = - xkb_info->xkb->ctrls->mk_interval = mouseSpeed->value; + xkb_info->xkb->ctrls->mk_interval = 40; xkb_info->config.mk_time_to_max = - xkb_info->xkb->ctrls->mk_time_to_max = mouseTime->value * 100; -/* xkb_info->xkb->ctrls->mk_max_speed = 500; - xkb_info->xkb->ctrls->mk_curve = 0;*/ + xkb_info->xkb->ctrls->mk_time_to_max = + (mouseTime->value * 1000) / xkb_info->xkb->ctrls->mk_interval; + xkb_info->config.mk_max_speed = + xkb_info->xkb->ctrls->mk_max_speed = + mouseSpeed->value * mouseTime->value; + xkb_info->config.mk_curve = xkb_info->xkb->ctrls->mk_curve = 0; } else { xkb_info->config.initial_ctrls &= ~(XkbMouseKeysMask | diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h index 4bf9ac2ae..a912fa380 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.4 2000/05/18 16:29:59 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.5 2000/08/04 16:13:44 eich Exp $ */ #include <X11/IntrinsicP.h> @@ -187,6 +187,9 @@ extern Widget ident_widget; extern char *ident_string; extern XF86ConfigPtr XF86Config; extern char *XF86Config_path; +extern char *XF86Module_path; +extern char *XF86Font_path; +extern char *XF86RGB_path; extern char *XFree86Dir; extern xf86cfgComputer computer; extern Atom wm_delete_window; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c index 19ed96443..e83cec850 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.4 2000/06/14 21:57:57 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.5 2000/08/04 16:13:44 eich Exp $ */ #include <X11/IntrinsicP.h> @@ -106,6 +106,9 @@ Widget toplevel, work, config, layout, layoutsme, layoutp; XtAppContext appcon; char *XF86Config_path = NULL; +char *XF86Module_path = NULL; +char *XF86Font_path = NULL; +char *XF86RGB_path = NULL; char *XFree86Dir; Bool xf86config_set = False; @@ -194,8 +197,20 @@ main(int argc, char *argv[]) if (i + 1 < argc) XF86Config_path = argv[i + 1]; break; + } else if (strcmp(argv[i], "-modulepath") == 0) { + if (i + 1 < argc) + XF86Module_path = argv[i + 1]; + break; + } else if (strcmp(argv[i], "-fontpath") == 0) { + if (i + 1 < argc) + XF86Font_path = argv[i + 1]; + break; + } else if (strcmp(argv[i], "-rgbpath") == 0) { + if (i + 1 < argc) + XF86RGB_path = argv[i + 1]; + break; } - + startedx = startx(); if (XF86Config_path == NULL) XF86Config_path = "/etc/X11/XF86Config"; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c index d589e392b..3c6bbb8c9 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.5 2000/06/20 05:08:50 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.7 2000/08/04 03:51:49 tsi Exp $ */ #include "xf86config.h" @@ -326,7 +326,7 @@ InitializeKeyboard(void) exit(1); } - xkb_info = XtNew(XkbInfo); + xkb_info = (XkbInfo *)XtCalloc(1, sizeof(XkbInfo)); xkb_info->conf = NULL; xkb_infos = (XkbInfo**)XtCalloc(1, sizeof(XkbInfo*)); num_xkb_infos = 1; @@ -568,6 +568,9 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf) if (conf->mk_time_to_max > 0) fprintf(fp, "MouseKeysTimeToMax = %d\n", conf->mk_time_to_max); + if (conf->mk_max_speed > 0) + fprintf(fp, "MouseKeysMaxSpeed = %d\n", + conf->mk_max_speed); fprintf(fp, "MouseKeysCurve = %d\n", conf->mk_curve); fprintf(fp, "AccessXTimeout = %d\n", conf->ax_timeout); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c index db4435596..3e4e73807 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.2 2000/05/18 16:29:59 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.3 2000/08/01 20:05:43 dawes Exp $ */ #include "xf86config.h" @@ -160,7 +160,7 @@ MouseConfig(XtPointer config) if ((option = xf86FindOption(mouse->inp_option_lst, Device)) != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(device); -/* XtFree(option->opt_comment);*/ + XtFree(option->opt_comment); } else { if (mouse->inp_option_lst == NULL) @@ -174,7 +174,7 @@ MouseConfig(XtPointer config) if ((option = xf86FindOption(mouse->inp_option_lst, Protocol)) != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(protocol); -/* XtFree(option->opt_comment);*/ + XtFree(option->opt_comment); } else xf86addNewOption(mouse->inp_option_lst, @@ -247,7 +247,6 @@ MouseEmulateCallback(Widget w, XtPointer user_data, XtPointer call_data) emulate = (Bool)call_data; } -/* This function does not yet work in 4.0 */ static void MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) { @@ -256,6 +255,10 @@ MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) XF86MiscGetMouseSettings(XtDisplay(w), &mouse); XtFree(mouse.device); + if (mouse.baudrate == 0 || mouse.baudrate < 0 || mouse.baudrate > 9600 || + mouse.baudrate % 1200) + mouse.baudrate = 1200; + if (strcmp(protocol, "BusMouse") == 0) mouse.type = MTYPE_BUSMOUSE; else if (strcmp(protocol, "GlidePoint") == 0) @@ -286,7 +289,6 @@ MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) mouse.emulate3buttons = emulate; mouse.flags |= MF_REOPEN; - /* This was not working in 3.3 */ mouse.device = device; XFlush(XtDisplay(w)); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c index 9748fd870..487a2a7ef 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.2 2000/05/18 16:30:00 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.3 2000/08/04 16:13:44 eich Exp $ */ #include "config.h" @@ -54,8 +54,24 @@ startx(void) if (XF86Config_path == NULL) { char *home, filename[PATH_MAX]; - - if (system("XFree86 :8 -configure") != 0) { + char commandline[PATH_MAX * 4]; + int c_pos; + int len; + + c_pos = XmuSnprintf(commandline, sizeof(commandline), + "XFree86 :8 -configure "); + + if (XF86Module_path && ((len = sizeof(commandline) - c_pos) > 0)) + c_pos += XmuSnprintf(commandline + c_pos,len, + " -modulepath %s",XF86Module_path); + if (XF86Font_path && ((len = sizeof(commandline) - c_pos) > 0)) + c_pos += XmuSnprintf(commandline + c_pos,len, + " -fontpath %s",XF86Font_path); + if (XF86RGB_path && ((len = sizeof(commandline) - c_pos) > 0)) + c_pos += XmuSnprintf(commandline + c_pos,len, + " -rgbpath %s",XF86RGB_path); + + if (system(commandline) != 0) { fprintf(stderr, "Failed to run \"XFree86 -configure\".\n"); exit(1); } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man index 6563a02bd..82115c5e0 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man @@ -26,14 +26,15 @@ .\" .\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.1 2000/06/13 23:15:52 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.2 2000/08/04 16:13:44 eich Exp $ .\" .TH xf86cfg 1 "Version 4.0" "XFree86" .SH NAME xf86cfg - Graphical configuration tool for XFree86 4.0 .SH SYNOPSIS .B xf86cfg -[-xf86config \fIXF86Config\fP] [-toolkitoption ...] +[-xf86config \fIXF86Config\fP] [-modulepath \fImoduledir\fP] +[-fontpath \fIfontsdir\fP] [-toolkitoption ...] .SH DESCRITPION .I Xf86cfg is a tool to configure \fIXFree86 4.0\fP, and can be used to either write the @@ -49,6 +50,9 @@ If the \fBDISPLAY\fP environment variable is set, xf86cfg will read the default \fIXF86Config\fP, that may not be the same being used by the current server, and allow customizations. .PP +To use an alternative location for modules or fonts the respective search +paths may be specified. +.PP Unless there is an \fBApply\fP button in the current xf86cfg dialog, the changes made will take place the next time \fIXFree86\fP is started. diff --git a/xc/programs/Xserver/hw/xnest/Display.h b/xc/programs/Xserver/hw/xnest/Display.h index 6f5c15d7d..749cbc5a6 100644 --- a/xc/programs/Xserver/hw/xnest/Display.h +++ b/xc/programs/Xserver/hw/xnest/Display.h @@ -12,7 +12,7 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Display.h,v 1.4 2000/06/17 00:27:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Display.h,v 1.5 2000/08/01 20:05:43 dawes Exp $ */ #ifndef XNESTCOMMON_H #define XNESTCOMMON_H @@ -20,7 +20,7 @@ is" without express or implied warranty. #define UNDEFINED -1 #define MAXDEPTH 32 -#define MAXVISUALSPERDEPTH 64 +#define MAXVISUALSPERDEPTH 256 extern Display *xnestDisplay; extern XVisualInfo *xnestVisuals; diff --git a/xc/programs/Xserver/hw/xwin/Imakefile b/xc/programs/Xserver/hw/xwin/Imakefile new file mode 100644 index 000000000..18743c54c --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/Imakefile @@ -0,0 +1,61 @@ +XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.1 2000/08/10 17:40:37 dawes Exp $ +#include <Server.tmpl> + +#if HasShm +SHMDEF = -DHAS_SHM +#endif + +XCOMM add more architectures here as we discover them +#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(cygwinArchitecture) || defined(i386BsdArchitecture) +MMAPDEF = -DHAS_MMAP +#endif + +#ifdef OS2Architecture +SRCS1 = os2_stubs.c +OBJS1 = os2_stubs.o +#endif + + + +SRCSA = InitInput.c InitOutput.c stubs.c miinitext.c directx.c ntux_xf.c + +OBJSA = InitInput.o InitOutput.o stubs.o miinitext.o directx.o ntux_xf.o + +INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ + -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \ + -I$(EXTINCSRC) -I$(XINCLUDESRC) + +DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI + +#if BuildDPMS +SRCSC = dpmsstubs.c +OBJSC = dpmsstubs.o +#endif + +SRCS = $(SRCSA) $(SRCSB) $(SRCSC) +OBJS = $(OBJSA) $(OBJSB) $(OBJSC) + +NormalLibraryObjectRule() +NormalLibraryTarget(Xwin,$(OBJS)) + +#ifdef OS2Architecture +LinkSourceFile(os2_stubs.c,../xfree86/os-support/os2) +SpecialCObjectRule(os2_stubs,$(ICONFIGFILES),-DOS2NULLSELECT) +#endif + +LinkSourceFile(stubs.c,../../Xi) +SpecialCObjectRule(InitInput,$(ICONFIGFILES),$(EXT_DEFINES)) + +LinkSourceFile(miinitext.c,../../mi) +SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) + +#if BuildDPMS +LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext) +SpecialCObjectRule(dpmsstubs,$(ICONFIGFILES),$(EXT_DEFINES)) +#endif + +NormalLibraryObjectRule() +NormalLibraryTarget(Xwin,$(OBJS)) + +DependTarget() diff --git a/xc/programs/Xserver/hw/xwin/InitInput.c b/xc/programs/Xserver/hw/xwin/InitInput.c new file mode 100644 index 000000000..103f947d4 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/InitInput.c @@ -0,0 +1,283 @@ +/* $TOG: InitInput.c /main/12 1998/02/10 13:23:52 kaleb $ */ +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group 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 Open Group. + +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ + + + +#include "X11/X.h" +#define NEED_EVENTS +#include "X11/Xproto.h" +#include "scrnintstr.h" +#include "inputstr.h" +#include "X11/Xos.h" +#include "mibstore.h" +#include "mipointer.h" +#include "winkeynames.h" +#include "winkeymap.h" +#include "keysym.h" + + + + +CARD32 lastEventTime = 0; + +int TimeSinceLastInputEvent() +{ + if (lastEventTime == 0) + lastEventTime = GetTimeInMillis(); + return GetTimeInMillis() - lastEventTime; +} + +void SetTimeSinceLastInputEvent() +{ + lastEventTime = GetTimeInMillis(); +} + +Bool +LegalModifier(key, pDev) + unsigned int key; + DevicePtr pDev; +{ + return TRUE; +} + +void +ProcessInputEvents() +{ + mieqProcessInputEvents(); + miPointerUpdate(); +} + +#define WIN_MIN_KEY 8 +#define WIN_MAX_KEY 255 + +void +GetWinMappings (pKeySyms, pModMap) + KeySymsPtr pKeySyms; + CARD8 *pModMap; +{ + KeySym *k; + char type; + int i, j; + KeySym *pMap; + + pMap = map; + + for (i = 0; i < MAP_LENGTH; i++) + pModMap[i] = NoSymbol; /* make sure it is restored */ + + for (k = pMap, i = MIN_KEYCODE; i < (NUM_KEYCODES + MIN_KEYCODE); i++, k += 4) + switch(*k) { + case XK_Shift_L: + case XK_Shift_R: + pModMap[i] = ShiftMask; + break; + + case XK_Control_L: + case XK_Control_R: + pModMap[i] = ControlMask; + break; + + case XK_Caps_Lock: + pModMap[i] = LockMask; + break; + + case XK_Alt_L: + case XK_Alt_R: + pModMap[i] = AltMask; + break; + + case XK_Num_Lock: + pModMap[i] = NumLockMask; + break; + + case XK_Scroll_Lock: + pModMap[i] = ScrollLockMask; + break; + + /* kana support */ + case XK_Kana_Lock: + case XK_Kana_Shift: + pModMap[i] = KanaMask; + break; + + /* alternate toggle for multinational support */ + case XK_Mode_switch: + pModMap[i] = AltLangMask; + break; + + } + pKeySyms->map = pMap; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_STD_KEYCODE; +} + +static int +winKeybdProc(pDevice, onoff) + DeviceIntPtr pDevice; + int onoff; +{ + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + int i; + DevicePtr pDev = (DevicePtr)pDevice; + + switch (onoff) + { + case DEVICE_INIT: + GetWinMappings(&keySyms, modMap); + InitKeyboardDeviceStruct(pDev, &keySyms, modMap, + (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA); + DIInitKeyboard () ; + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + pDev->on = FALSE; + break; + case DEVICE_CLOSE: + DITermKeyboard () ; + break; + } + return Success; +} + +static int +winMouseProc(pDevice, onoff) + DeviceIntPtr pDevice; + int onoff; +{ + BYTE map[4]; + DevicePtr pDev = (DevicePtr)pDevice; + + switch (onoff) + { + case DEVICE_INIT: + map[1] = 1; + map[2] = 2; + map[3] = 3; + InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents, + (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize()); + DIInitMouse () ; + break; + + case DEVICE_ON: + pDev->on = TRUE; + break; + + case DEVICE_OFF: + pDev->on = FALSE; + break; + + case DEVICE_CLOSE: + DITermMouse () ; + break; + } + return Success; +} + +void +InitInput(argc, argv) + int argc; + char *argv[]; +{ + DevicePtr p, k; + p = AddInputDevice(winMouseProc, TRUE); + k = AddInputDevice(winKeybdProc, TRUE); + RegisterPointerDevice(p); + RegisterKeyboardDevice(k); + miRegisterPointerDevice(screenInfo.screens[0], p); + (void)mieqInit (k, p); +} + +GenerateInputEvent (type, ix, iy, button) +{ + xEvent x ; + + /* Event types defined in directx.c */ + switch (type) + { + case 0: /* Mouse motion */ + miPointerDeltaCursor (ix,iy,lastEventTime = GetTimeInMillis ()); + break; + + case 1: /* Mouse button pressed */ + x.u.u.type = ButtonPress; + x.u.u.detail = Button1 + button ; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); + mieqEnqueue(&x); + break; + + case 2: /* Mouse button released */ + x.u.u.type = ButtonRelease; + x.u.u.detail = button + 1 ; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); + mieqEnqueue(&x); + break; + + case 3: /* Keyboard keypress */ + x.u.u.type = KeyPress; + x.u.u.detail = button + MIN_KEYCODE ; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); + mieqEnqueue(&x); + break; + + case 4: /* Keyboard keyrelease */ + x.u.u.type = KeyRelease; + x.u.u.detail = button + MIN_KEYCODE ; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); + mieqEnqueue(&x); + break ; + } +} + +#ifdef XTESTEXT1 +void +XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey) + int dev_type; + int keycode; + int keystate; + int mousex; + int mousey; +{ +} + +void +XTestGetPointerPos(fmousex, fmousey) + short *fmousex, *fmousey; +{ +} + +void +XTestJumpPointer(jx, jy, dev_type) + int jx; + int jy; + int dev_type; +{ +} +#endif + diff --git a/xc/programs/Xserver/hw/xwin/InitOutput.c b/xc/programs/Xserver/hw/xwin/InitOutput.c new file mode 100644 index 000000000..d984bcd0d --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/InitOutput.c @@ -0,0 +1,810 @@ +/* $TOG: InitOutput.c /main/20 1998/02/10 13:23:56 kaleb $ */ +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group 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 Open Group. + +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ + +#if defined(WIN32) && !defined(__CYGWIN__) +#include <X11/Xwinsock.h> +#endif +#include <stdio.h> +#include "X11/X.h" +#define NEED_EVENTS +#include "X11/Xproto.h" +#include "X11/Xos.h" +#include "scrnintstr.h" +#include "servermd.h" +#define PSZ 8 +#include "cfb.h" +#include "mibstore.h" +#include "colormapst.h" +#include "gcstruct.h" +#include "input.h" +#include "mipointer.h" +#include <sys/types.h> +#ifdef HAS_MMAP +#include <sys/mman.h> +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#endif /* HAS_MMAP */ +#include <sys/stat.h> +#include <errno.h> +#ifndef WIN32 +#include <sys/param.h> +#endif +#include <X11/XWDFile.h> +#if defined(HAS_SHM) && !defined(__CYGWIN__) +#include <sys/cygipc.h> +#include <sys/shm.h> +#endif /* HAS_SHM */ +#include "dix.h" +#include "miline.h" + +/* +* modified 05/27/00 p. busch +* peter.busch@dfki.de +* +* framebuffer is now mapped via the ntux_ddx library +*/ + +/* +* added - pb +*/ + +/* implemented in ntux_xf.c */ +extern char * map_dx_fb( char *adr, unsigned long size ); + + + + +extern char *display; + +#define WIN_DEFAULT_WIDTH 1280 +#define WIN_DEFAULT_HEIGHT 1024 +#define WIN_DEFAULT_DEPTH 16 +#define WIN_DEFAULT_WHITEPIXEL 255 +#define WIN_DEFAULT_BLACKPIXEL 0 +#define WIN_DEFAULT_LINEBIAS 0 +#define XWD_WINDOW_NAME_LEN 60 + +typedef struct +{ + int scrnum; + int width; + int paddedWidth; + int height; + int depth; + int bitsPerPixel; + char *pfbMemory; + XWDColor *pXWDCmap; + XWDFileHeader *pXWDHeader; + Pixel blackPixel; + Pixel whitePixel; + ScreenPtr pScreen ; + unsigned int lineBias; + +} winScreenInfo, *winScreenInfoPtr; + +static int winNumScreens; +static winScreenInfo winScreens[MAXSCREENS]; +static Bool winPixmapDepths[33]; +static char *pfbdir = NULL; +typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType; +static fbMemType fbmemtype = NORMAL_MEMORY_FB; +static char needswap = 0; +static int lastScreen = -1; + +#define swapcopy16(_dst, _src) \ + if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \ + else _dst = _src; + +#define swapcopy32(_dst, _src) \ + if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \ + else _dst = _src; + + +static void +winInitializePixmapDepths() +{ + int i; + winPixmapDepths[1] = TRUE; /* always need bitmaps */ + for (i = 2; i <= 32; i++) + winPixmapDepths[i] = FALSE; +} + +static Bool +winCreateDefColormap (ScreenPtr pScreen) +{ + /* + * these are the MS-Windows desktop colors, adjusted for X's 16-bit + * color specifications. + */ + static xColorItem citems[] = { + { 0, 0, 0, 0, 0, 0 }, + { 1, 0x8000, 0, 0, 0, 0 }, + { 2, 0, 0x8000, 0, 0, 0 }, + { 3, 0x8000, 0x8000, 0, 0, 0 }, + { 4, 0, 0, 0x8000, 0, 0 }, + { 5, 0x8000, 0, 0x8000, 0, 0 }, + { 6, 0, 0x8000, 0x8000, 0, 0 }, + { 7, 0xc000, 0xc000, 0xc000, 0, 0 }, + { 8, 0xc000, 0xdc00, 0xc000, 0, 0 }, + { 9, 0xa600, 0xca00, 0xf000, 0, 0 }, + { 246, 0xff00, 0xfb00, 0xf000, 0, 0 }, + { 247, 0xa000, 0xa000, 0xa400, 0, 0 }, + { 248, 0x8000, 0x8000, 0x8000, 0, 0 }, + { 249, 0xff00, 0, 0, 0, 0 }, + { 250, 0, 0xff00, 0, 0, 0 }, + { 251, 0xff00, 0xff00, 0, 0, 0 }, + { 252, 0, 0, 0xff00, 0, 0 }, + { 253, 0xff00, 0, 0xff00, 0, 0 }, + { 254, 0, 0xff00, 0xff00, 0, 0 }, + { 255, 0xff00, 0xff00, 0xff00, 0, 0 } + }; +#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0] + int i; + Pixel wp, bp; + VisualPtr pVisual; + ColormapPtr cmap; + unsigned short zero = 0, ones = 0xFFFF; + + for (pVisual = pScreen->visuals; + pVisual->vid != pScreen->rootVisual; + pVisual++) + ; + + if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, + (pVisual->class & DynamicClass) ? AllocNone : AllocAll, + 0) + != Success) + return FALSE; + if (pVisual->class == PseudoColor) + { + for (i = 0; i < NUM_DESKTOP_COLORS; i++) { + if (AllocColor (cmap, + &citems[i].red, &citems[i].green, &citems[i].blue, + &citems[i].pixel, 0) != Success) + return FALSE; + } + pScreen->whitePixel = 255 ; + pScreen->blackPixel = 0 ; + } else { + if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != + Success) || + (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != + Success)) + return FALSE; + pScreen->whitePixel = wp; + pScreen->blackPixel = bp; + } + (*pScreen->InstallColormap)(cmap); + return TRUE; +} + +static void +winInitializeDefaultScreens() +{ + int i; + + for (i = 0; i < MAXSCREENS; i++) + { + winScreens[i].scrnum = i; + winScreens[i].width = WIN_DEFAULT_WIDTH; + winScreens[i].height = WIN_DEFAULT_HEIGHT; + winScreens[i].depth = WIN_DEFAULT_DEPTH; + winScreens[i].blackPixel = WIN_DEFAULT_BLACKPIXEL; + winScreens[i].whitePixel = WIN_DEFAULT_WHITEPIXEL; + winScreens[i].lineBias = WIN_DEFAULT_LINEBIAS; + winScreens[i].pfbMemory = NULL; + } + winNumScreens = 1; +} + +static int +winBitsPerPixel(depth) + int depth; +{ + if (depth == 1) return 1; + else if (depth <= 8) return 8; + else if (depth <= 16) return 16; + else if (depth <= 24) return 24; + else return 32; +} + +void +ddxGiveUp() +{ + return ; +} + +void +AbortDDX() +{ + ddxGiveUp(); +} + +void +OsVendorInit() +{ +} + +void +ddxUseMsg() +{ + ErrorF("-screen scrn WxHxD set screen's width, height, depth\n"); + ErrorF("-pixdepths list-of-int support given pixmap depths\n"); + ErrorF("-linebias n adjust thin line pixelization\n"); + ErrorF("-blackpixel n pixel value for black\n"); + ErrorF("-whitepixel n pixel value for white\n"); +} + +int +ddxProcessArgument (argc, argv, i) + int argc; + char *argv[]; + int i; +{ + static Bool firstTime = TRUE; + + if (firstTime) + { + winInitializeDefaultScreens(); + winInitializePixmapDepths(); + firstTime = FALSE; + } + + if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */ + { + int screenNum; + if (i + 2 >= argc) UseMsg(); + screenNum = atoi(argv[i+1]); + if (screenNum < 0 || screenNum >= MAXSCREENS) + { + ErrorF("Invalid screen number %d\n", screenNum); + UseMsg(); + } + if (3 != sscanf(argv[i+2], "%dx%dx%d", + &winScreens[screenNum].width, + &winScreens[screenNum].height, + &winScreens[screenNum].depth)) + { + ErrorF("Invalid screen configuration %s\n", argv[i+2]); + UseMsg(); + } + + if (screenNum >= winNumScreens) + winNumScreens = screenNum + 1; + lastScreen = screenNum; + return 3; + } + + if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */ + { + int depth, ret = 1; + + if (++i >= argc) UseMsg(); + while ((i < argc) && (depth = atoi(argv[i++])) != 0) + { + if (depth < 0 || depth > 32) + { + ErrorF("Invalid pixmap depth %d\n", depth); + UseMsg(); + } + winPixmapDepths[depth] = TRUE; + ret++; + } + return ret; + } + + if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ + { + Pixel pix; + if (++i >= argc) UseMsg(); + pix = atoi(argv[i]); + if (-1 == lastScreen) + { + int i; + for (i = 0; i < MAXSCREENS; i++) + { + winScreens[i].blackPixel = pix; + } + } + else + { + winScreens[lastScreen].blackPixel = pix; + } + return 2; + } + + if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */ + { + Pixel pix; + if (++i >= argc) UseMsg(); + pix = atoi(argv[i]); + if (-1 == lastScreen) + { + int i; + for (i = 0; i < MAXSCREENS; i++) + { + winScreens[i].whitePixel = pix; + } + } + else + { + winScreens[lastScreen].whitePixel = pix; + } + return 2; + } + + if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */ + { + unsigned int linebias; + if (++i >= argc) UseMsg(); + linebias = atoi(argv[i]); + if (-1 == lastScreen) + { + int i; + for (i = 0; i < MAXSCREENS; i++) + { + winScreens[i].lineBias = linebias; + } + } + else + { + winScreens[lastScreen].lineBias = linebias; + } + return 2; + } + + if (strcmp (argv[i], "-probe") == 0) /* -linebias n */ + { + ListModes () ; + return 1 ; + } + + return 0; +} + +#ifdef DDXTIME /* from ServerOSDefines */ +CARD32 +GetTimeInMillis() +{ + struct timeval tp; + + X_GETTIMEOFDAY(&tp); + return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); +} +#endif + + +static Bool +winMultiDepthCreateGC(pGC) + GCPtr pGC; +{ + switch (winBitsPerPixel(pGC->depth)) + { + case 1: return mfbCreateGC (pGC); + case 8: return cfbCreateGC (pGC); + case 16: return cfb16CreateGC (pGC); + case 24: return cfb24CreateGC (pGC); + case 32: return cfb32CreateGC (pGC); + default: return FALSE; + } +} + +static void +winMultiDepthGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart) + DrawablePtr pDrawable; /* drawable from which to get bits */ + int wMax; /* largest value of all *pwidths */ + register DDXPointPtr ppt; /* points to start copying from */ + int *pwidth; /* list of number of bits to copy */ + int nspans; /* number of scanlines to copy */ + char *pdstStart; /* where to put the bits */ +{ + switch (pDrawable->bitsPerPixel) { + case 1: + mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); + break; + case 8: + cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); + break; + case 16: + cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); + break; + case 24: + cfb24GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); + break; + case 32: + cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); + break; + } + return; +} + +static void +winMultiDepthGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) + DrawablePtr pDrawable; + int sx, sy, w, h; + unsigned int format; + unsigned long planeMask; + char *pdstLine; +{ + switch (pDrawable->bitsPerPixel) + { + case 1: + mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); + break; + case 8: + cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); + break; + case 16: + cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); + break; + case 24: + cfb24GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); + break; + case 32: + cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); + break; + } +} + +static ColormapPtr InstalledMaps[MAXSCREENS]; + +static int +winListInstalledColormaps(pScreen, pmaps) + ScreenPtr pScreen; + Colormap *pmaps; +{ + /* By the time we are processing requests, we can guarantee that there + * is always a colormap installed */ + *pmaps = InstalledMaps[pScreen->myNum]->mid; + return (1); +} + + +static void +winInstallColormap(pmap) + ColormapPtr pmap; +{ + int index = pmap->pScreen->myNum; + ColormapPtr oldpmap = InstalledMaps[index]; + + if (pmap != oldpmap) + { + int entries; + VisualPtr pVisual; + Pixel * ppix; + xrgb * prgb; + xColorItem *defs; + int i; + + if(oldpmap != (ColormapPtr)None) + WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); + /* Install pmap */ + InstalledMaps[index] = pmap; + WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); + + entries = pmap->pVisual->ColormapEntries; + pVisual = pmap->pVisual; + + ppix = (Pixel *)ALLOCATE_LOCAL(entries * sizeof(Pixel)); + prgb = (xrgb *)ALLOCATE_LOCAL(entries * sizeof(xrgb)); + defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem)); + + for (i = 0; i < entries; i++) ppix[i] = i; + /* XXX truecolor */ + QueryColors(pmap, entries, ppix, prgb); + + for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */ + defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */ + defs[i].red = prgb[i].red; + defs[i].green = prgb[i].green; + defs[i].blue = prgb[i].blue; + defs[i].flags = DoRed|DoGreen|DoBlue; + } + (*pmap->pScreen->StoreColors)(pmap, entries, defs); + + DEALLOCATE_LOCAL(ppix); + DEALLOCATE_LOCAL(prgb); + DEALLOCATE_LOCAL(defs); + } +} + +static void +winUninstallColormap(pmap) + ColormapPtr pmap; +{ + ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum]; + + if(pmap == curpmap) + { + if (pmap->mid != pmap->pScreen->defColormap) + { + curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, + RT_COLORMAP); + (*pmap->pScreen->InstallColormap)(curpmap); + } + } +} + +static void +winStoreColors(pmap, ndef, pdefs) + ColormapPtr pmap; + int ndef; + xColorItem *pdefs; +{ + int i; + + if (pmap != InstalledMaps[pmap->pScreen->myNum]) return; + + if ((pmap->pVisual->class | DynamicClass) == DirectColor) + return; + + // TrueColor or Pseudo Color + if (pmap->pVisual->class == PseudoColor) + for (i = 0; i < ndef; i++, pdefs++) + DXStoreColors (pdefs->pixel, pdefs->red, pdefs->green, pdefs->blue) ; +} + +static Bool +winSaveScreen(pScreen, on) + ScreenPtr pScreen; + int on; +{ + return TRUE; +} + +static char * +winAllocateFramebufferMemory(pwin) + winScreenInfoPtr pwin; +{ + unsigned long size; + char *ntux_ddx_fb = NULL; + + + pwin->pfbMemory = winDXAllocateFramebufferMemory (&pwin->width, + &pwin->height, &pwin->depth, &pwin->paddedWidth); + + + size = pwin->width * pwin->height * ((pwin->depth + 7)/8); + /* + ntux_ddx_fb = map_dx_fb( pwin->pfbMemory, size ); + + if( ntux_ddx_fb ) + { + pwin->pfbMemory = ntux_ddx_fb; + return ntux_ddx_fb; + } + */ + return pwin->pfbMemory ; +} + +static Bool +winCursorOffScreen (ppScreen, x, y) + ScreenPtr *ppScreen; + int *x, *y; +{ + return FALSE; +} + +static void +winCrossScreen (pScreen, entering) + ScreenPtr pScreen; + Bool entering; +{ +} + +static miPointerScreenFuncRec winPointerCursorFuncs = +{ + winCursorOffScreen, + winCrossScreen, + miPointerWarpCursor +}; + +Bool miCreateScreenResources (ScreenPtr pScreen) ; + +static Bool +winScreenInit(index, pScreen, argc, argv) + int index; + ScreenPtr pScreen; + + + int argc; + char ** argv; +{ + winScreenInfoPtr pwin = &winScreens[index]; + int dpix = 100, dpiy = 100; + int ret = FALSE; + char *pbits; + unsigned long stack_ptr; + + pwin->paddedWidth = PixmapBytePad(pwin->width, pwin->depth); + pwin->bitsPerPixel = winBitsPerPixel(pwin->depth); + + fprintf( stderr, "pwin->width = %08x\n", pwin->width ); + fprintf( stderr, "pwin->height = %08x\n", pwin->height ); + fprintf( stderr, "pwin->paddedWidth = %08x\n", pwin->paddedWidth ); + fprintf( stderr, "pwin->bitsPerPixel = %08x\n", pwin->bitsPerPixel ); + + fprintf( stderr, "calling winAllocateFramebufferMemory\n" ); + + + pbits = winAllocateFramebufferMemory( pwin ); + + if (!pbits) + return FALSE; + + + switch (pwin->bitsPerPixel) + { + case 1: + ret = mfbScreenInit(pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth * 8); + break; + case 8: + fprintf( stderr, "calling cfbScreenInit( %08x, %08x, %08x, %08x, %08x, %08x, %08x )\n", + pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + + ret = cfbScreenInit(pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + break; + case 16: + fprintf( stderr, "calling cfb16ScreenInit( %08x, %08x, %08x, %08x, %08x, %08x, %08x )\n", + pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + ret = cfb16ScreenInit(pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + + break; + case 24: + fprintf( stderr, "calling cfb24ScreenInit( %08x, %08x, %08x, %08x, %08x, %08x, %08x )\n", + pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + ret = cfb24ScreenInit(pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + break; + case 32: + fprintf( stderr, "calling cfb32ScreenInit( %08x, %08x, %08x, %08x, %08x, %08x, %08x )\n", + pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + + ret = cfb32ScreenInit(pScreen, pbits, pwin->width, pwin->height, + dpix, dpiy, pwin->paddedWidth); + break; + default: + return FALSE; + } + + if (!ret) return FALSE; + + pScreen->CreateGC = winMultiDepthCreateGC; + pScreen->GetImage = winMultiDepthGetImage; + pScreen->GetSpans = winMultiDepthGetSpans; + + pScreen->InstallColormap = winInstallColormap; + pScreen->UninstallColormap = winUninstallColormap; + pScreen->ListInstalledColormaps = winListInstalledColormaps; + + pScreen->SaveScreen = winSaveScreen; + pScreen->StoreColors = winStoreColors; + + miDCInitialize(pScreen, &winPointerCursorFuncs); + + pScreen->blackPixel = pwin->blackPixel; + pScreen->whitePixel = pwin->whitePixel; + + if (pwin->bitsPerPixel == 1) + { + ret = mfbCreateDefColormap(pScreen); + } + else + { + ret = winCreateDefColormap(pScreen); + } + + miSetZeroLineBias(pScreen, pwin->lineBias); + + if (ret) + { + extern winfbBlockHandler (), winfbWakeupHandler () ; + + RegisterBlockAndWakeupHandlers (winfbBlockHandler, winfbWakeupHandler, NULL) ; + } + pwin->pScreen = pScreen ; + ErrorF ("Successful addition of Screen %p %p\n", pScreen->devPrivate, pScreen) ; + return ret; + +} /* end winScreenInit */ + + +void +InitOutput(screenInfo, argc, argv) + ScreenInfo *screenInfo; + int argc; + char **argv; +{ + int i; + int NumFormats = 0; + FILE *pf = stderr; + + + + /* initialize pixmap formats */ + +/* cfbLoad() ;*/ + /* must have a pixmap depth to match every screen depth */ + for (i = 0; i < winNumScreens; i++) + { + winPixmapDepths[winScreens[i].depth] = TRUE; + } + + for (i = 1; i <= 32; i++) + { + if (winPixmapDepths[i]) + { + if (NumFormats >= MAXFORMATS) + FatalError ("MAXFORMATS is too small for this server\n"); + screenInfo->formats[NumFormats].depth = i; + screenInfo->formats[NumFormats].bitsPerPixel = winBitsPerPixel(i); + screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; + NumFormats++; + } + } + + screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + screenInfo->numPixmapFormats = NumFormats; + + /* initialize screens */ + + for (i = 0; i < winNumScreens; i++) + { + if (-1 == AddScreen(winScreenInit, argc, argv)) + { + FatalError("Couldn't add screen %d", i); + } + } + +} /* end InitOutput */ + +void +SwitchFramebuffer (pointer pbits) +{ + PixmapPtr pmap ; + ScreenPtr s = winScreens[0].pScreen ; + + pmap = ((PixmapPtr) (s)->devPrivate) ; + /* + if (winScreens[0].depth == 8) + pmap = ((PixmapPtr) (s)->devPrivate) ; + else + pmap = ((PixmapPtr) (s)->devPrivates[0].ptr) ; + */ + ErrorF ("Switch: %p, %p\n", winScreens[0].pScreen, pmap) ; + pmap->devPrivate.ptr = pbits ; +} diff --git a/xc/programs/Xserver/hw/xwin/ddraw.h b/xc/programs/Xserver/hw/xwin/ddraw.h new file mode 100644 index 000000000..30b370f18 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/ddraw.h @@ -0,0 +1,1514 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ + +#ifndef __WINE_DDRAW_H +#define __WINE_DDRAW_H + +#include <X11/Xlib.h> +#ifdef HAVE_LIBXXSHM +#include <X11/extensions/XShm.h> +#endif /* defined(HAVE_LIBXXSHM) */ + +#include "winnt.h" /* LARGE_INTEGER ... */ +#include "wingdi.h" /* PALETTE stuff ... */ +#include "wine/obj_base.h" + +#ifndef DIRECTDRAW_VERSION +#define DIRECTDRAW_VERSION 0x0500 +#endif /* DIRECTDRAW_VERSION */ + +/***************************************************************************** + * Predeclare the interfaces + */ +DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); +DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); +DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); +DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawColorControl,0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); + +typedef struct IDirectDraw IDirectDraw,*LPDIRECTDRAW; +typedef struct IDirectDraw2 IDirectDraw2,*LPDIRECTDRAW2; +typedef struct IDirectDraw4 IDirectDraw4,*LPDIRECTDRAW4; +typedef struct IDirectDrawClipper IDirectDrawClipper,*LPDIRECTDRAWCLIPPER; +typedef struct IDirectDrawPalette IDirectDrawPalette,*LPDIRECTDRAWPALETTE; +typedef struct IDirectDrawSurface IDirectDrawSurface,*LPDIRECTDRAWSURFACE; +typedef struct IDirectDrawSurface2 IDirectDrawSurface2,*LPDIRECTDRAWSURFACE2; +typedef struct IDirectDrawSurface3 IDirectDrawSurface3,*LPDIRECTDRAWSURFACE3; +typedef struct IDirectDrawSurface4 IDirectDrawSurface4,*LPDIRECTDRAWSURFACE4; +typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLORCONTROL; + + +#define DDENUMRET_CANCEL 0 +#define DDENUMRET_OK 1 + +#define DD_OK 0 + + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) +#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) +#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) +#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) +#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) +#define DDERR_GENERIC E_FAIL +#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) +#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) +#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) +#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) +#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) +#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) +#define DDERR_INVALIDPARAMS E_INVALIDARG +#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) +#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) +#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) +#define DDERR_NO3D MAKE_DDHRESULT( 170 ) +#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) +#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) +#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) +#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) +#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) +#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) +#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) +#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) +#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) +#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) +#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) +#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) +#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) +#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) +#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) +#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) +#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) +#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) +#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) +#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) +#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) +#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) +#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) +#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) +#define DDERR_OUTOFMEMORY E_OUTOFMEMORY +#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) +#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) +#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) +#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) +#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) +#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) +#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) +#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) +#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) +#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) +#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) +#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) +#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) +#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) +#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) +#define DDERR_UNSUPPORTED E_NOTIMPL +#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) +#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) +#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) +#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) +#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) +#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) +#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) +#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) +#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) +#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) +#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) +#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) +#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) +#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) +#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) +#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) +#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) +#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) +#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) +#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) +#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) +#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) +#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) +#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) +#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) +#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) +#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) +#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) +#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) +#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) +#define DDERR_NODC MAKE_DDHRESULT( 586 ) +#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) +#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) +#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) +#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) +#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) +#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) +#define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) +#define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) +#define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) +#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) +#define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) +#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) +#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) +#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) +#define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) +#define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) +#define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) +#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED + +/* dwFlags for Blt* */ +#define DDBLT_ALPHADEST 0x00000001 +#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002 +#define DDBLT_ALPHADESTNEG 0x00000004 +#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008 +#define DDBLT_ALPHAEDGEBLEND 0x00000010 +#define DDBLT_ALPHASRC 0x00000020 +#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040 +#define DDBLT_ALPHASRCNEG 0x00000080 +#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100 +#define DDBLT_ASYNC 0x00000200 +#define DDBLT_COLORFILL 0x00000400 +#define DDBLT_DDFX 0x00000800 +#define DDBLT_DDROPS 0x00001000 +#define DDBLT_KEYDEST 0x00002000 +#define DDBLT_KEYDESTOVERRIDE 0x00004000 +#define DDBLT_KEYSRC 0x00008000 +#define DDBLT_KEYSRCOVERRIDE 0x00010000 +#define DDBLT_ROP 0x00020000 +#define DDBLT_ROTATIONANGLE 0x00040000 +#define DDBLT_ZBUFFER 0x00080000 +#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000 +#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000 +#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000 +#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000 +#define DDBLT_WAIT 0x01000000 +#define DDBLT_DEPTHFILL 0x02000000 + +/* dwTrans for BltFast */ +#define DDBLTFAST_NOCOLORKEY 0x00000000 +#define DDBLTFAST_SRCCOLORKEY 0x00000001 +#define DDBLTFAST_DESTCOLORKEY 0x00000002 +#define DDBLTFAST_WAIT 0x00000010 + +/* dwFlags for Flip */ +#define DDFLIP_WAIT 0x00000001 +#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ +#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ + +/* dwFlags for GetBltStatus */ +#define DDGBS_CANBLT 0x00000001 +#define DDGBS_ISBLTDONE 0x00000002 + +/* DDSCAPS.dwCaps */ +/* reserved1, was 3d capable */ +#define DDSCAPS_RESERVED1 0x00000001 +/* surface contains alpha information */ +#define DDSCAPS_ALPHA 0x00000002 +/* this surface is a backbuffer */ +#define DDSCAPS_BACKBUFFER 0x00000004 +/* complex surface structure */ +#define DDSCAPS_COMPLEX 0x00000008 +/* part of surface flipping structure */ +#define DDSCAPS_FLIP 0x00000010 +/* this surface is the frontbuffer surface */ +#define DDSCAPS_FRONTBUFFER 0x00000020 +/* this is a plain offscreen surface */ +#define DDSCAPS_OFFSCREENPLAIN 0x00000040 +/* overlay */ +#define DDSCAPS_OVERLAY 0x00000080 +/* palette objects can be created and attached to us */ +#define DDSCAPS_PALETTE 0x00000100 +/* primary surface (the one the user looks at currently)(right eye)*/ +#define DDSCAPS_PRIMARYSURFACE 0x00000200 +/* primary surface for left eye */ +#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400 +/* surface exists in systemmemory */ +#define DDSCAPS_SYSTEMMEMORY 0x00000800 +/* surface can be used as a texture */ +#define DDSCAPS_TEXTURE 0x00001000 +/* surface may be destination for 3d rendering */ +#define DDSCAPS_3DDEVICE 0x00002000 +/* surface exists in videomemory */ +#define DDSCAPS_VIDEOMEMORY 0x00004000 +/* surface changes immediately visible */ +#define DDSCAPS_VISIBLE 0x00008000 +/* write only surface */ +#define DDSCAPS_WRITEONLY 0x00010000 +/* zbuffer surface */ +#define DDSCAPS_ZBUFFER 0x00020000 +/* has its own DC */ +#define DDSCAPS_OWNDC 0x00040000 +/* surface should be able to receive live video */ +#define DDSCAPS_LIVEVIDEO 0x00080000 +/* should be able to have a hw codec decompress stuff into it */ +#define DDSCAPS_HWCODEC 0x00100000 +/* mode X (320x200 or 320x240) surface */ +#define DDSCAPS_MODEX 0x00200000 +/* one mipmap surface (1 level) */ +#define DDSCAPS_MIPMAP 0x00400000 +#define DDSCAPS_RESERVED2 0x00800000 +/* memory allocation delayed until Load() */ +#define DDSCAPS_ALLOCONLOAD 0x04000000 +/* Indicates that the surface will recieve data from a video port */ +#define DDSCAPS_VIDEOPORT 0x08000000 +/* surface is in local videomemory */ +#define DDSCAPS_LOCALVIDMEM 0x10000000 +/* surface is in nonlocal videomemory */ +#define DDSCAPS_NONLOCALVIDMEM 0x20000000 +/* surface is a standard VGA mode surface (NOT ModeX) */ +#define DDSCAPS_STANDARDVGAMODE 0x40000000 +/* optimized? surface */ +#define DDSCAPS_OPTIMIZED 0x80000000 + +typedef struct _DDSCAPS { + DWORD dwCaps; /* capabilities of surface wanted */ +} DDSCAPS,*LPDDSCAPS; + +#define DD_ROP_SPACE (256/32) /* space required to store ROP array */ + +typedef struct _DDCAPS_DX3 +{ + DWORD dwSize; /* size of the DDDRIVERCAPS structure */ + DWORD dwCaps; /* driver specific capabilities */ + DWORD dwCaps2; /* more driver specific capabilites */ + DWORD dwCKeyCaps; /* color key capabilities of the surface */ + DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ + DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ + DWORD dwPalCaps; /* palette capabilities */ + DWORD dwSVCaps; /* stereo vision capabilities */ + DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ + DWORD dwVidMemTotal; /* total amount of video memory */ + DWORD dwVidMemFree; /* amount of free video memory */ + DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ + DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ + DWORD dwNumFourCCCodes; /* number of four cc codes */ + DWORD dwAlignBoundarySrc; /* source rectangle alignment */ + DWORD dwAlignSizeSrc; /* source rectangle byte size */ + DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ + DWORD dwAlignSizeDest; /* dest rectangle byte size */ + DWORD dwAlignStrideAlign; /* stride alignment */ + DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ + DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ + DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ + DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ + DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ + DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ + DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ + DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ + DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ + DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ + DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ + DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ + DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ + DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ + DWORD dwReserved4; + DWORD dwReserved5; + DWORD dwReserved6; +} DDCAPS_DX3,*LPDDCAPS_DX3; + +typedef struct _DDCAPS +{ +/* 0*/ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ +/* 4*/ DWORD dwCaps; /* driver specific capabilities */ +/* 8*/ DWORD dwCaps2; /* more driver specific capabilites */ +/* c*/ DWORD dwCKeyCaps; /* color key capabilities of the surface */ +/* 10*/ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ +/* 14*/ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ +/* 18*/ DWORD dwPalCaps; /* palette capabilities */ +/* 1c*/ DWORD dwSVCaps; /* stereo vision capabilities */ +/* 20*/ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ +/* 24*/ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ +/* 38*/ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ +/* 3c*/ DWORD dwVidMemTotal; /* total amount of video memory */ +/* 40*/ DWORD dwVidMemFree; /* amount of free video memory */ +/* 44*/ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ +/* 48*/ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ +/* 4c*/ DWORD dwNumFourCCCodes; /* number of four cc codes */ +/* 50*/ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ +/* 54*/ DWORD dwAlignSizeSrc; /* source rectangle byte size */ +/* 58*/ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ +/* 5c*/ DWORD dwAlignSizeDest; /* dest rectangle byte size */ +/* 60*/ DWORD dwAlignStrideAlign; /* stride alignment */ +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ +/* 84*/ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ +/* 88*/ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* 8c*/ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* 90*/ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* 94*/ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* 98*/ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* 9c*/ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ +/* a0*/ DWORD dwReserved1; +/* a4*/ DWORD dwReserved2; +/* a8*/ DWORD dwReserved3; +/* ac*/ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ +/* b0*/ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ +/* b4*/ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ +/* d8*/ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ +/* dc*/ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ +/* e0*/ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ +/*104*/ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ +/*108*/ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ +/*10c*/ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ +#if DIRECTDRAW_VERSION >= 0x0500 +/*130*/ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ +/*134*/ DWORD dwCurrVideoPorts;/* current number of video ports used */ +/*138*/ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ +/*13c*/ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ +/*140*/ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ +/*144*/ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ +/*148*/ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE];/* ROPS supported for non-local->local blts */ +#else /* DIRECTDRAW_VERSION >= 0x0500 */ +/*130*/ DWORD dwReserved4; +/*134*/ DWORD dwReserved5; +/*138*/ DWORD dwReserved6; +#endif /* DIRECTDRAW_VERSION >= 0x0500 */ +} DDCAPS,*LPDDCAPS; + + +/* DDCAPS.dwCaps */ +#define DDCAPS_3D 0x00000001 +#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002 +#define DDCAPS_ALIGNSIZEDEST 0x00000004 +#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008 +#define DDCAPS_ALIGNSIZESRC 0x00000010 +#define DDCAPS_ALIGNSTRIDE 0x00000020 +#define DDCAPS_BLT 0x00000040 +#define DDCAPS_BLTQUEUE 0x00000080 +#define DDCAPS_BLTFOURCC 0x00000100 +#define DDCAPS_BLTSTRETCH 0x00000200 +#define DDCAPS_GDI 0x00000400 +#define DDCAPS_OVERLAY 0x00000800 +#define DDCAPS_OVERLAYCANTCLIP 0x00001000 +#define DDCAPS_OVERLAYFOURCC 0x00002000 +#define DDCAPS_OVERLAYSTRETCH 0x00004000 +#define DDCAPS_PALETTE 0x00008000 +#define DDCAPS_PALETTEVSYNC 0x00010000 +#define DDCAPS_READSCANLINE 0x00020000 +#define DDCAPS_STEREOVIEW 0x00040000 +#define DDCAPS_VBI 0x00080000 +#define DDCAPS_ZBLTS 0x00100000 +#define DDCAPS_ZOVERLAYS 0x00200000 +#define DDCAPS_COLORKEY 0x00400000 +#define DDCAPS_ALPHA 0x00800000 +#define DDCAPS_COLORKEYHWASSIST 0x01000000 +#define DDCAPS_NOHARDWARE 0x02000000 +#define DDCAPS_BLTCOLORFILL 0x04000000 +#define DDCAPS_BANKSWITCHED 0x08000000 +#define DDCAPS_BLTDEPTHFILL 0x10000000 +#define DDCAPS_CANCLIP 0x20000000 +#define DDCAPS_CANCLIPSTRETCHED 0x40000000 +#define DDCAPS_CANBLTSYSMEM 0x80000000 + +/* DDCAPS.dwCaps2 */ +#define DDCAPS2_CERTIFIED 0x00000001 +#define DDCAPS2_NO2DDURING3DSCENE 0x00000002 +#define DDCAPS2_VIDEOPORT 0x00000004 +#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008 +#define DDCAPS2_CANBOBINTERLEAVED 0x00000010 +#define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020 +#define DDCAPS2_COLORCONTROLOVERLAY 0x00000040 +#define DDCAPS2_COLORCONTROLPRIMARY 0x00000080 +#define DDCAPS2_CANDROPZ16BIT 0x00000100 +#define DDCAPS2_NONLOCALVIDMEM 0x00000200 +#define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400 +#define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800 +#define DDCAPS2_WIDESURFACES 0x00001000 +#define DDCAPS2_CANFLIPODDEVEN 0x00002000 +#define DDCAPS2_CANBOBHARDWARE 0x00004000 + + +/* Set/Get Colour Key Flags */ +#define DDCKEY_COLORSPACE 0x00000001 /* Struct is single colour space */ +#define DDCKEY_DESTBLT 0x00000002 /* To be used as dest for blt */ +#define DDCKEY_DESTOVERLAY 0x00000004 /* To be used as dest for CK overlays */ +#define DDCKEY_SRCBLT 0x00000008 /* To be used as src for blt */ +#define DDCKEY_SRCOVERLAY 0x00000010 /* To be used as src for CK overlays */ + +typedef struct _DDCOLORKEY +{ + DWORD dwColorSpaceLowValue;/* low boundary of color space that is to + * be treated as Color Key, inclusive + */ + DWORD dwColorSpaceHighValue;/* high boundary of color space that is + * to be treated as Color Key, inclusive + */ +} DDCOLORKEY,*LPDDCOLORKEY; + +/* ddCKEYCAPS bits */ +#define DDCKEYCAPS_DESTBLT 0x00000001 +#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002 +#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004 +#define DDCKEYCAPS_DESTBLTYUV 0x00000008 +#define DDCKEYCAPS_DESTOVERLAY 0x00000010 +#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020 +#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040 +#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080 +#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100 +#define DDCKEYCAPS_SRCBLT 0x00000200 +#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400 +#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800 +#define DDCKEYCAPS_SRCBLTYUV 0x00001000 +#define DDCKEYCAPS_SRCOVERLAY 0x00002000 +#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000 +#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000 +#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000 +#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000 +#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000 + +typedef struct _DDPIXELFORMAT { + DWORD dwSize; /* 0: size of structure */ + DWORD dwFlags; /* 4: pixel format flags */ + DWORD dwFourCC; /* 8: (FOURCC code) */ + union { + DWORD dwRGBBitCount; /* C: how many bits per pixel */ + DWORD dwYUVBitCount; /* C: how many bits per pixel */ + DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */ + DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/ + } x; + union { + DWORD dwRBitMask; /* 10: mask for red bit*/ + DWORD dwYBitMask; /* 10: mask for Y bits*/ + } y; + union { + DWORD dwGBitMask; /* 14: mask for green bits*/ + DWORD dwUBitMask; /* 14: mask for U bits*/ + } z; + union { + DWORD dwBBitMask; /* 18: mask for blue bits*/ + DWORD dwVBitMask; /* 18: mask for V bits*/ + } xx; + union { + DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */ + DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */ + DWORD dwRGBZBitMask; /* 1C: mask for Z channel */ + DWORD dwYUVZBitMask; /* 1C: mask for Z channel */ + } xy; + /* 20: next structure */ +} DDPIXELFORMAT,*LPDDPIXELFORMAT; + +/* DDCAPS.dwFXCaps */ +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 +#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010 +#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 +#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080 +#define DDFXCAPS_BLTROTATION 0x00000100 +#define DDFXCAPS_BLTROTATION90 0x00000200 +#define DDFXCAPS_BLTSHRINKX 0x00000400 +#define DDFXCAPS_BLTSHRINKXN 0x00000800 +#define DDFXCAPS_BLTSHRINKY 0x00001000 +#define DDFXCAPS_BLTSHRINKYN 0x00002000 +#define DDFXCAPS_BLTSTRETCHX 0x00004000 +#define DDFXCAPS_BLTSTRETCHXN 0x00008000 +#define DDFXCAPS_BLTSTRETCHY 0x00010000 +#define DDFXCAPS_BLTSTRETCHYN 0x00020000 +#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000 +#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008 +#define DDFXCAPS_OVERLAYSHRINKX 0x00080000 +#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000 +#define DDFXCAPS_OVERLAYSHRINKY 0x00200000 +#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000 +#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000 +#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000 +#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000 +#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000 +#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 +#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 + +/* DDCAPS.dwFXAlphaCaps */ +#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001 +#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002 +#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004 +#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008 +#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010 +#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020 +#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040 +#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080 +#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100 +#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200 + +/* DDCAPS.dwPalCaps */ +#define DDPCAPS_4BIT 0x00000001 +#define DDPCAPS_8BITENTRIES 0x00000002 +#define DDPCAPS_8BIT 0x00000004 +#define DDPCAPS_INITIALIZE 0x00000008 +#define DDPCAPS_PRIMARYSURFACE 0x00000010 +#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020 +#define DDPCAPS_ALLOW256 0x00000040 +#define DDPCAPS_VSYNC 0x00000080 +#define DDPCAPS_1BIT 0x00000100 +#define DDPCAPS_2BIT 0x00000200 +#define DDPCAPS_ALPHA 0x00000400 + +/* DDCAPS.dwSVCaps */ +#define DDSVCAPS_ENIGMA 0x00000001l +#define DDSVCAPS_FLICKER 0x00000002l +#define DDSVCAPS_REDBLUE 0x00000004l +#define DDSVCAPS_SPLIT 0x00000008l + +/* BitDepths */ +#define DDBD_1 0x00004000 +#define DDBD_2 0x00002000 +#define DDBD_4 0x00001000 +#define DDBD_8 0x00000800 +#define DDBD_16 0x00000400 +#define DDBD_24 0x00000200 +#define DDBD_32 0x00000100 + +/* DDOVERLAYFX.dwDDFX */ +#define DDOVERFX_ARITHSTRETCHY 0x00000001 +#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002 +#define DDOVERFX_MIRRORUPDOWN 0x00000004 + +/* DDCOLORKEY.dwFlags */ +#define DDPF_ALPHAPIXELS 0x00000001 +#define DDPF_ALPHA 0x00000002 +#define DDPF_FOURCC 0x00000004 +#define DDPF_PALETTEINDEXED4 0x00000008 +#define DDPF_PALETTEINDEXEDTO8 0x00000010 +#define DDPF_PALETTEINDEXED8 0x00000020 +#define DDPF_RGB 0x00000040 +#define DDPF_COMPRESSED 0x00000080 +#define DDPF_RGBTOYUV 0x00000100 +#define DDPF_YUV 0x00000200 +#define DDPF_ZBUFFER 0x00000400 +#define DDPF_PALETTEINDEXED1 0x00000800 +#define DDPF_PALETTEINDEXED2 0x00001000 +#define DDPF_ZPIXELS 0x00002000 + +/* SetCooperativeLevel dwFlags */ +#define DDSCL_FULLSCREEN 0x00000001 +#define DDSCL_ALLOWREBOOT 0x00000002 +#define DDSCL_NOWINDOWCHANGES 0x00000004 +#define DDSCL_NORMAL 0x00000008 +#define DDSCL_EXCLUSIVE 0x00000010 +#define DDSCL_ALLOWMODEX 0x00000040 +#define DDSCL_SETFOCUSWINDOW 0x00000080 +#define DDSCL_SETDEVICEWINDOW 0x00000100 +#define DDSCL_CREATEDEVICEWINDOW 0x00000200 + + +/* DDSURFACEDESC.dwFlags */ +#define DDSD_CAPS 0x00000001 +#define DDSD_HEIGHT 0x00000002 +#define DDSD_WIDTH 0x00000004 +#define DDSD_PITCH 0x00000008 +#define DDSD_BACKBUFFERCOUNT 0x00000020 +#define DDSD_ZBUFFERBITDEPTH 0x00000040 +#define DDSD_ALPHABITDEPTH 0x00000080 +#define DDSD_LPSURFACE 0x00000800 +#define DDSD_PIXELFORMAT 0x00001000 +#define DDSD_CKDESTOVERLAY 0x00002000 +#define DDSD_CKDESTBLT 0x00004000 +#define DDSD_CKSRCOVERLAY 0x00008000 +#define DDSD_CKSRCBLT 0x00010000 +#define DDSD_MIPMAPCOUNT 0x00020000 +#define DDSD_REFRESHRATE 0x00040000 +#define DDSD_LINEARSIZE 0x00080000 +#define DDSD_ALL 0x000ff9ee + +/* EnumSurfaces flags */ +#define DDENUMSURFACES_ALL 0x00000001 +#define DDENUMSURFACES_MATCH 0x00000002 +#define DDENUMSURFACES_NOMATCH 0x00000004 +#define DDENUMSURFACES_CANBECREATED 0x00000008 +#define DDENUMSURFACES_DOESEXIST 0x00000010 + +/* SetDisplayMode flags */ +#define DDSDM_STANDARDVGAMODE 0x00000001 + +/* EnumDisplayModes flags */ +#define DDEDM_REFRESHRATES 0x00000001 +#define DDEDM_STANDARDVGAMODES 0x00000002 + + +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/ + DWORD dwFlags; /* 4: determines what fields are valid*/ + DWORD dwHeight; /* 8: height of surface to be created*/ + DWORD dwWidth; /* C: width of input surface*/ + LONG lPitch; /*10: distance to start of next line (return value only)*/ + DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ + union { + DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ + DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/ + DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ + } x; + DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ + DWORD dwReserved; /* 20:reserved*/ + union { + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ + DWORD dwLinearSize; /* 24:Formless late-allocated optimized surface size*/ + } y; + DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/ + DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ + DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ + DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/ + DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ + DDSCAPS ddsCaps; /* 68: direct draw surface caps */ +} DDSURFACEDESC,*LPDDSURFACEDESC; + +/* DDCOLORCONTROL.dwFlags */ +#define DDCOLOR_BRIGHTNESS 0x00000001 +#define DDCOLOR_CONTRAST 0x00000002 +#define DDCOLOR_HUE 0x00000004 +#define DDCOLOR_SATURATION 0x00000008 +#define DDCOLOR_SHARPNESS 0x00000010 +#define DDCOLOR_GAMMA 0x00000020 +#define DDCOLOR_COLORENABLE 0x00000040 + +typedef struct { + DWORD dwSize; + DWORD dwFlags; + LONG lBrightness; + LONG lContrast; + LONG lHue; + LONG lSaturation; + LONG lSharpness; + LONG lGamma; + LONG lColorEnable; + DWORD dwReserved1; +} DDCOLORCONTROL,*LPDDCOLORCONTROL; + +typedef BOOL (CALLBACK * LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); +typedef BOOL (CALLBACK * LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); +DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACK) + +typedef HRESULT (CALLBACK * LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT (CALLBACK * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); + +typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); +typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); +DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACKEX) + +HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); +HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); + +/* flags for DirectDrawEnumerateEx */ +#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001 +#define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002 +#define DDENUM_NONDISPLAYDEVICES 0x00000004 + +typedef struct _DDBLTFX +{ + DWORD dwSize; /* size of structure */ + DWORD dwDDFX; /* FX operations */ + DWORD dwROP; /* Win32 raster operations */ + DWORD dwDDROP; /* Raster operations new for DirectDraw */ + DWORD dwRotationAngle; /* Rotation angle for blt */ + DWORD dwZBufferOpCode; /* ZBuffer compares */ + DWORD dwZBufferLow; /* Low limit of Z buffer */ + DWORD dwZBufferHigh; /* High limit of Z buffer */ + DWORD dwZBufferBaseDest; /* Destination base value */ + DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */ + union + { + DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ + LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ + } x; + DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ + union + { + DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ + LPDIRECTDRAWSURFACE lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ + } y; + DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ + DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ + union + { + DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ + LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */ + } z; + DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ + union + { + DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ + } a; + union + { + DWORD dwFillColor; /* color in RGB or Palettized */ + DWORD dwFillDepth; /* depth value for z-buffer */ + DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ + LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */ + } b; + DDCOLORKEY ddckDestColorkey; /* DestColorkey override */ + DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ +} DDBLTFX,*LPDDBLTFX; + +/* dwDDFX */ +/* arithmetic stretching along y axis */ +#define DDBLTFX_ARITHSTRETCHY 0x00000001 +/* mirror on y axis */ +#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002 +/* mirror on x axis */ +#define DDBLTFX_MIRRORUPDOWN 0x00000004 +/* do not tear */ +#define DDBLTFX_NOTEARING 0x00000008 +/* 180 degrees clockwise rotation */ +#define DDBLTFX_ROTATE180 0x00000010 +/* 270 degrees clockwise rotation */ +#define DDBLTFX_ROTATE270 0x00000020 +/* 90 degrees clockwise rotation */ +#define DDBLTFX_ROTATE90 0x00000040 +/* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */ +#define DDBLTFX_ZBUFFERRANGE 0x00000080 +/* add dwZBufferBaseDest to every source z value before compare */ +#define DDBLTFX_ZBUFFERBASEDEST 0x00000100 + +typedef struct _DDOVERLAYFX +{ + DWORD dwSize; /* size of structure */ + DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ + DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */ + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ + union + { + DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ + LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ + } x; + DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ + union + { + DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ + } y; + DDCOLORKEY dckDestColorkey; /* DestColorkey override */ + DDCOLORKEY dckSrcColorkey; /* DestColorkey override */ + DWORD dwDDFX; /* Overlay FX */ + DWORD dwFlags; /* flags */ +} DDOVERLAYFX,*LPDDOVERLAYFX; + +typedef struct _DDBLTBATCH +{ + LPRECT lprDest; + LPDIRECTDRAWSURFACE lpDDSSrc; + LPRECT lprSrc; + DWORD dwFlags; + LPDDBLTFX lpDDBltFx; +} DDBLTBATCH,*LPDDBLTBATCH; + +#define MAX_DDDEVICEID_STRING 512 + +typedef struct tagDDDEVICEIDENTIFIER { + char szDriver[MAX_DDDEVICEID_STRING]; + char szDescription[MAX_DDDEVICEID_STRING]; + LARGE_INTEGER liDriverVersion; + DWORD dwVendorId; + DWORD dwDeviceId; + DWORD dwSubSysId; + DWORD dwRevision; + GUID guidDeviceIdentifier; +} DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; + + +/***************************************************************************** + * IDirectDrawPalette interface + */ +#define ICOM_INTERFACE IDirectDrawPalette +#define IDirectDrawPalette_METHODS \ + ICOM_METHOD1(HRESULT,GetCaps, LPDWORD,lpdwCaps) \ + ICOM_METHOD4(HRESULT,GetEntries, DWORD,dwFlags, DWORD,dwBase, DWORD,dwNumEntries, LPPALETTEENTRY,lpEntries) \ + ICOM_METHOD3(HRESULT,Initialize, LPDIRECTDRAW,lpDD, DWORD,dwFlags, LPPALETTEENTRY,lpDDColorTable) \ + ICOM_METHOD4(HRESULT,SetEntries, DWORD,dwFlags, DWORD,dwStartingEntry, DWORD,dwCount, LPPALETTEENTRY,lpEntries) +#define IDirectDrawPalette_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawPalette_METHODS +ICOM_DEFINE(IDirectDrawPalette,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawPalette_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawPalette_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawPalette_Release(p) ICOM_CALL (Release,p) + /*** IDirectDrawPalette methods ***/ +#define IDirectDrawPalette_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawPalette_GetEntries(p,a,b,c,d) ICOM_CALL4(GetEntries,p,a,b,c,d) +#define IDirectDrawPalette_Initialize(p,a,b,c) ICOM_CALL3(Initialize,p,a,b,c) +#define IDirectDrawPalette_SetEntries(p,a,b,c,d) ICOM_CALL4(SetEntries,p,a,b,c,d) +#endif + + +/***************************************************************************** + * IDirectDrawClipper interface + */ +#define ICOM_INTERFACE IDirectDrawClipper +#define IDirectDrawClipper_METHODS \ + ICOM_METHOD3(HRESULT,GetClipList, LPRECT,lpRect, LPRGNDATA,lpClipList, LPDWORD,lpdwSize) \ + ICOM_METHOD1(HRESULT,GetHWnd, HWND*,lphWnd) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,IsClipListChanged, BOOL*,lpbChanged) \ + ICOM_METHOD2(HRESULT,SetClipList, LPRGNDATA,lpClipList, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,SetHWnd, DWORD,dwFlags, HWND,hWnd) +#define IDirectDrawClipper_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawClipper_METHODS +ICOM_DEFINE(IDirectDrawClipper,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawClipper_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawClipper_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawClipper_Release(p) ICOM_CALL (Release,p) + /*** IDirectDrawClipper methods ***/ +#define IDirectDrawClipper_GetClipList(p,a,b,c) ICOM_CALL3(GetClipList,p,a,b,c) +#define IDirectDrawClipper_GetHWnd(p,a) ICOM_CALL1(GetHWnd,p,a) +#define IDirectDrawClipper_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawClipper_IsClipListChanged(p,a) ICOM_CALL1(IsClipListChanged,p,a) +#define IDirectDrawClipper_SetClipList(p,a,b) ICOM_CALL2(SetClipList,p,a,b) +#define IDirectDrawClipper_SetHWnd(p,a,b) ICOM_CALL2(SetHWnd,p,a,b) +#endif + + +/***************************************************************************** + * IDirectDraw interface + */ +#define ICOM_INTERFACE IDirectDraw +#define IDirectDraw_METHODS \ + ICOM_METHOD (HRESULT,Compact) \ + ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ + ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ + ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE*,lplpDDSurface, IUnknown*,pUnkOuter) \ + ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE,lpDDSurface, LPDIRECTDRAWSURFACE*,lplpDupDDSurface) \ + ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK,lpEnumModesCallback) \ + ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD (HRESULT,FlipToGDISurface) \ + ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ + ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ + ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE*,lplpGDIDDSurface) \ + ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ + ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ + ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ + ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ + ICOM_METHOD (HRESULT,RestoreDisplayMode) \ + ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ + ICOM_METHOD3(HRESULT,SetDisplayMode, DWORD,, DWORD,, DWORD,) \ + ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) +#define IDirectDraw_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDraw_METHODS +ICOM_DEFINE(IDirectDraw,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDraw_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDraw_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDraw_Release(p) ICOM_CALL (Release,p) + /*** IDirectDraw methods ***/ +#define IDirectDraw_Compact(p) ICOM_CALL (Compact,p) +#define IDirectDraw_CreateClipper(p,a,b,c) ICOM_CALL3(CreateClipper,p,a,b,c) +#define IDirectDraw_CreatePalette(p,a,b,c,d) ICOM_CALL4(CreatePalette,p,a,b,c,d) +#define IDirectDraw_CreateSurface(p,a,b,c) ICOM_CALL3(CreateSurface,p,a,b,c) +#define IDirectDraw_DuplicateSurface(p,a,b) ICOM_CALL2(DuplicateSurface,p,a,b) +#define IDirectDraw_EnumDisplayModes(p,a,b,c,d) ICOM_CALL4(EnumDisplayModes,p,a,b,c,d) +#define IDirectDraw_EnumSurfaces(p,a,b,c,d) ICOM_CALL4(EnumSurfaces,p,a,b,c,d) +#define IDirectDraw_FlipToGDISurface(p) ICOM_CALL (FlipToGDISurface,p) +#define IDirectDraw_GetCaps(p,a,b) ICOM_CALL2(GetCaps,p,a,b) +#define IDirectDraw_GetDisplayMode(p,a) ICOM_CALL1(GetDisplayMode,p,a) +#define IDirectDraw_GetFourCCCodes(p,a,b) ICOM_CALL2(GetFourCCCodes,p,a,b) +#define IDirectDraw_GetGDISurface(p,a) ICOM_CALL1(GetGDISurface,p,a) +#define IDirectDraw_GetMonitorFrequency(p,a) ICOM_CALL1(GetMonitorFrequency,p,a) +#define IDirectDraw_GetScanLine(p,a) ICOM_CALL1(GetScanLine,p,a) +#define IDirectDraw_GetVerticalBlankStatus(p,a) ICOM_CALL1(GetVerticalBlankStatus,p,a) +#define IDirectDraw_Initialize(p,a) ICOM_CALL1(Initialize,p,a) +#define IDirectDraw_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) +#define IDirectDraw_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectDraw_SetDisplayMode(p,a,b,c) ICOM_CALL3(SetDisplayMode,p,a,b,c) +#define IDirectDraw_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) +#endif + + +/* flags for Lock() */ +#define DDLOCK_SURFACEMEMORYPTR 0x00000000 +#define DDLOCK_WAIT 0x00000001 +#define DDLOCK_EVENT 0x00000002 +#define DDLOCK_READONLY 0x00000010 +#define DDLOCK_WRITEONLY 0x00000020 +#define DDLOCK_NOSYSLOCK 0x00000800 + + +/***************************************************************************** + * IDirectDraw2 interface + */ +/* Note: IDirectDraw2 cannot derive from IDirectDraw because the number of + * arguments of SetDisplayMode has changed ! + */ +#define ICOM_INTERFACE IDirectDraw2 +#define IDirectDraw2_METHODS \ + ICOM_METHOD (HRESULT,Compact) \ + ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ + ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ + ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE*,lplpDDSurface, IUnknown*,pUnkOuter) \ + ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE,lpDDSurface, LPDIRECTDRAWSURFACE*,lplpDupDDSurface) \ + ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK,lpEnumModesCallback) \ + ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD (HRESULT,FlipToGDISurface) \ + ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ + ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ + ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE*,lplpGDIDDSurface) \ + ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ + ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ + ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ + ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ + ICOM_METHOD (HRESULT,RestoreDisplayMode) \ + ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ + /* added in v2 */ \ + ICOM_METHOD3(HRESULT,GetAvailableVidMem, LPDDSCAPS,lpDDCaps, LPDWORD,lpdwTotal, LPDWORD,lpdwFree) +#define IDirectDraw2_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDraw2_METHODS +ICOM_DEFINE(IDirectDraw2,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDraw2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDraw2_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDraw2_Release(p) ICOM_CALL (Release,p) + /*** IDirectDraw methods ***/ +#define IDirectDraw2_Compact(p) ICOM_CALL (Compact,p) +#define IDirectDraw2_CreateClipper(p,a,b,c) ICOM_CALL3(CreateClipper,p,a,b,c) +#define IDirectDraw2_CreatePalette(p,a,b,c,d) ICOM_CALL4(CreatePalette,p,a,b,c,d) +#define IDirectDraw2_CreateSurface(p,a,b,c) ICOM_CALL3(CreateSurface,p,a,b,c) +#define IDirectDraw2_DuplicateSurface(p,a,b) ICOM_CALL2(DuplicateSurface,p,a,b) +#define IDirectDraw2_EnumDisplayModes(p,a,b,c,d) ICOM_CALL4(EnumDisplayModes,p,a,b,c,d) +#define IDirectDraw2_EnumSurfaces(p,a,b,c,d) ICOM_CALL4(EnumSurfaces,p,a,b,c,d) +#define IDirectDraw2_FlipToGDISurface(p) ICOM_CALL (FlipToGDISurface,p) +#define IDirectDraw2_GetCaps(p,a,b) ICOM_CALL2(GetCaps,p,a,b) +#define IDirectDraw2_GetDisplayMode(p,a) ICOM_CALL1(GetDisplayMode,p,a) +#define IDirectDraw2_GetFourCCCodes(p,a,b) ICOM_CALL2(GetFourCCCodes,p,a,b) +#define IDirectDraw2_GetGDISurface(p,a) ICOM_CALL1(GetGDISurface,p,a) +#define IDirectDraw2_GetMonitorFrequency(p,a) ICOM_CALL1(GetMonitorFrequency,p,a) +#define IDirectDraw2_GetScanLine(p,a) ICOM_CALL1(GetScanLine,p,a) +#define IDirectDraw2_GetVerticalBlankStatus(p,a) ICOM_CALL1(GetVerticalBlankStatus,p,a) +#define IDirectDraw2_Initialize(p,a) ICOM_CALL1(Initialize,p,a) +#define IDirectDraw2_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) +#define IDirectDraw2_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectDraw2_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL5(SetDisplayMode,p,a,b,c,d,e) +#define IDirectDraw2_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) +/*** IDirectDraw2 methods ***/ +#define IDirectDraw2_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) +#endif + + +/***************************************************************************** + * IDirectDraw4 interface + */ +#define ICOM_INTERFACE IDirectDraw4 +#define IDirectDraw4_METHODS \ + ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE*,) \ + ICOM_METHOD (HRESULT,RestoreAllSurfaces) \ + ICOM_METHOD (HRESULT,TestCooperativeLevel) \ + ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER,, DWORD,) +#define IDirectDraw4_IMETHODS \ + IDirectDraw2_IMETHODS \ + IDirectDraw4_METHODS +ICOM_DEFINE(IDirectDraw4,IDirectDraw2) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDraw4_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDraw4_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDraw4_Release(p) ICOM_CALL (Release,p) + /*** IDirectDraw methods ***/ +#define IDirectDraw4_Compact(p) ICOM_CALL (Compact,p) +#define IDirectDraw4_CreateClipper(p,a,b,c) ICOM_CALL3(CreateClipper,p,a,b,c) +#define IDirectDraw4_CreatePalette(p,a,b,c,d) ICOM_CALL4(CreatePalette,p,a,b,c,d) +#define IDirectDraw4_CreateSurface(p,a,b,c) ICOM_CALL3(CreateSurface,p,a,b,c) +#define IDirectDraw4_DuplicateSurface(p,a,b) ICOM_CALL2(DuplicateSurface,p,a,b) +#define IDirectDraw4_EnumDisplayModes(p,a,b,c,d) ICOM_CALL4(EnumDisplayModes,p,a,b,c,d) +#define IDirectDraw4_EnumSurfaces(p,a,b,c,d) ICOM_CALL4(EnumSurfaces,p,a,b,c,d) +#define IDirectDraw4_FlipToGDISurface(p) ICOM_CALL (FlipToGDISurface,p) +#define IDirectDraw4_GetCaps(p,a,b) ICOM_CALL2(GetCaps,p,a,b) +#define IDirectDraw4_GetDisplayMode(p,a) ICOM_CALL1(GetDisplayMode,p,a) +#define IDirectDraw4_GetFourCCCodes(p,a,b) ICOM_CALL2(GetFourCCCodes,p,a,b) +#define IDirectDraw4_GetGDISurface(p,a) ICOM_CALL1(GetGDISurface,p,a) +#define IDirectDraw4_GetMonitorFrequency(p,a) ICOM_CALL1(GetMonitorFrequency,p,a) +#define IDirectDraw4_GetScanLine(p,a) ICOM_CALL1(GetScanLine,p,a) +#define IDirectDraw4_GetVerticalBlankStatus(p,a) ICOM_CALL1(GetVerticalBlankStatus,p,a) +#define IDirectDraw4_Initialize(p,a) ICOM_CALL1(Initialize,p,a) +#define IDirectDraw4_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) +#define IDirectDraw4_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectDraw4_SetDisplayMode(p,a,b,c) ICOM_CALL3(SetDisplayMode,p,a,b,c) +#define IDirectDraw4_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) +/*** IDirectDraw2 methods ***/ +#define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) +/*** IDirectDraw4 methods ***/ +#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b,c) +#define IDirectDraw4_RestoreAllSurfaces(pc) ICOM_CALL (RestoreAllSurfaces,p) +#define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL (TestCooperativeLevel,p) +#define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL2(GetDeviceIdentifier,p,a,b) +#endif + + +/***************************************************************************** + * IDirectDrawSurface interface + */ +#define ICOM_INTERFACE IDirectDrawSurface +#define IDirectDrawSurface_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ + ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ + ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ + ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ + ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ + ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ + ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ + ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ + ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ + ICOM_METHOD (HRESULT,Restore) \ + ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ + ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ + ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ + ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ + ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSReference) +#define IDirectDrawSurface_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface_METHODS +ICOM_DEFINE(IDirectDrawSurface,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawSurface_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawSurface_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawSurface_Release(p) ICOM_CALL (Release,p) + /*** IDirectDrawSurface methods ***/ +#define IDirectDrawSurface_AddAttachedSurface(p,a) ICOM_CALL1(AddAttachedSurface,p,a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) ICOM_CALL1(AddOverlayDirtyRect,p,a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) ICOM_CALL5(Blt,p,a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) ICOM_CALL3(BltBatch,p,a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) ICOM_CALL5(BltFast,p,a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) ICOM_CALL2(DeleteAttachedSurface,p,a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) ICOM_CALL2(EnumAttachedSurfaces,p,a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) ICOM_CALL3(EnumOverlayZOrders,p,a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) ICOM_CALL2(Flip,p,a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) ICOM_CALL2(GetAttachedSurface,p,a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) ICOM_CALL1(GetBltStatus,p,a) +#define IDirectDrawSurface_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawSurface_GetClipper(p,a) ICOM_CALL1(GetClipper,p,a) +#define IDirectDrawSurface_GetColorKey(p,a,b) ICOM_CALL2(GetColorKey,p,a,b) +#define IDirectDrawSurface_GetDC(p,a) ICOM_CALL1(GetDC,p,a) +#define IDirectDrawSurface_GetFlipStatus(p,a) ICOM_CALL1(GetFlipStatus,p,a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) ICOM_CALL2(GetOverlayPosition,p,a,b) +#define IDirectDrawSurface_GetPalette(p,a) ICOM_CALL1(GetPalette,p,a) +#define IDirectDrawSurface_GetPixelFormat(p,a) ICOM_CALL1(GetPixelFormat,p,a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) ICOM_CALL1(GetSurfaceDesc,p,a) +#define IDirectDrawSurface_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawSurface_IsLost(p) ICOM_CALL (IsLost,p) +#define IDirectDrawSurface_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) +#define IDirectDrawSurface_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) +#define IDirectDrawSurface_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) +#define IDirectDrawSurface_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) +#define IDirectDrawSurface_Unlock(p,a) ICOM_CALL1(Unlock,p,a) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) +#endif + + +/***************************************************************************** + * IDirectDrawSurface2 interface + */ +/* Cannot inherit from IDirectDrawSurface because the LPDIRECTDRAWSURFACE parameters + * have been converted to LPDIRECTDRAWSURFACE2. + */ +#define ICOM_INTERFACE IDirectDrawSurface2 +#define IDirectDrawSurface2_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE2,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE2,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ + ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE2,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE2,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE2,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE2*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ + ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ + ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ + ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ + ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ + ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ + ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ + ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ + ICOM_METHOD (HRESULT,Restore) \ + ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ + ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ + ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ + ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ + ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE2,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE2,lpDDSReference) \ + /* added in v2 */ \ + ICOM_METHOD1(HRESULT,GetDDInterface, LPVOID*,lplpDD) \ + ICOM_METHOD1(HRESULT,PageLock, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,PageUnlock, DWORD,dwFlags) +#define IDirectDrawSurface2_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface2_METHODS +ICOM_DEFINE(IDirectDrawSurface2,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawSurface2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawSurface2_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawSurface2_Release(p) ICOM_CALL (Release,p) +/*** IDirectDrawSurface methods (almost) ***/ +#define IDirectDrawSurface2_AddAttachedSurface(p,a) ICOM_CALL1(AddAttachedSurface,p,a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) ICOM_CALL1(AddOverlayDirtyRect,p,a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) ICOM_CALL5(Blt,p,a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) ICOM_CALL3(BltBatch,p,a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ICOM_CALL5(BltFast,p,a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) ICOM_CALL2(DeleteAttachedSurface,p,a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) ICOM_CALL2(EnumAttachedSurfaces,p,a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) ICOM_CALL3(EnumOverlayZOrders,p,a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) ICOM_CALL2(Flip,p,a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) ICOM_CALL2(GetAttachedSurface,p,a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) ICOM_CALL1(GetBltStatus,p,a) +#define IDirectDrawSurface2_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawSurface2_GetClipper(p,a) ICOM_CALL1(GetClipper,p,a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) ICOM_CALL2(GetColorKey,p,a,b) +#define IDirectDrawSurface2_GetDC(p,a) ICOM_CALL1(GetDC,p,a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) ICOM_CALL1(GetFlipStatus,p,a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) ICOM_CALL2(GetOverlayPosition,p,a,b) +#define IDirectDrawSurface2_GetPalette(p,a) ICOM_CALL1(GetPalette,p,a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) ICOM_CALL1(GetPixelFormat,p,a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) ICOM_CALL1(GetSurfaceDesc,p,a) +#define IDirectDrawSurface2_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawSurface2_IsLost(p) ICOM_CALL (IsLost,p) +#define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) +#define IDirectDrawSurface2_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) +#define IDirectDrawSurface2_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface2_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) +#define IDirectDrawSurface2_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) +#define IDirectDrawSurface2_Unlock(p,a) ICOM_CALL1(Unlock,p,a) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) +/*** IDirectDrawSurface2 methods ***/ +#define IDirectDrawSurface2_GetDDInterface(p,a) ICOM_CALL1(GetDDInterface,p,a) +#define IDirectDrawSurface2_PageLock(p,a) ICOM_CALL1(PageLock,p,a) +#define IDirectDrawSurface2_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) +#endif + + +/***************************************************************************** + * IDirectDrawSurface3 interface + */ +/* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters + * have been converted to LPDIRECTDRAWSURFACE3. + */ +#define ICOM_INTERFACE IDirectDrawSurface3 +#define IDirectDrawSurface3_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE3,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE3,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ + ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE3,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE3,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE3,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE3*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ + ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ + ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ + ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ + ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ + ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ + ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ + ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ + ICOM_METHOD (HRESULT,Restore) \ + ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ + ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ + ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ + ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ + ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE3,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE3,lpDDSReference) \ + /* added in v2 */ \ + ICOM_METHOD1(HRESULT,GetDDInterface, LPVOID*,lplpDD) \ + ICOM_METHOD1(HRESULT,PageLock, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,PageUnlock, DWORD,dwFlags) \ + /* added in v3 */ \ + ICOM_METHOD2(HRESULT,SetSurfaceDesc, LPDDSURFACEDESC,lpDDSD, DWORD,dwFlags) +#define IDirectDrawSurface3_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface3_METHODS +ICOM_DEFINE(IDirectDrawSurface3,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawSurface3_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawSurface3_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawSurface3_Release(p) ICOM_CALL (Release,p) +/*** IDirectDrawSurface methods (almost) ***/ +#define IDirectDrawSurface3_AddAttachedSurface(p,a) ICOM_CALL1(AddAttachedSurface,p,a) +#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) ICOM_CALL1(AddOverlayDirtyRect,p,a) +#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) ICOM_CALL5(Blt,p,a,b,c,d,e) +#define IDirectDrawSurface3_BltBatch(p,a,b,c) ICOM_CALL3(BltBatch,p,a,b,c) +#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) ICOM_CALL5(BltFast,p,a,b,c,d,e) +#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) ICOM_CALL2(DeleteAttachedSurface,p,a,b) +#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) ICOM_CALL2(EnumAttachedSurfaces,p,a,b) +#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) ICOM_CALL3(EnumOverlayZOrders,p,a,b,c) +#define IDirectDrawSurface3_Flip(p,a,b) ICOM_CALL2(Flip,p,a,b) +#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) ICOM_CALL2(GetAttachedSurface,p,a,b) +#define IDirectDrawSurface3_GetBltStatus(p,a) ICOM_CALL1(GetBltStatus,p,a) +#define IDirectDrawSurface3_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawSurface3_GetClipper(p,a) ICOM_CALL1(GetClipper,p,a) +#define IDirectDrawSurface3_GetColorKey(p,a,b) ICOM_CALL2(GetColorKey,p,a,b) +#define IDirectDrawSurface3_GetDC(p,a) ICOM_CALL1(GetDC,p,a) +#define IDirectDrawSurface3_GetFlipStatus(p,a) ICOM_CALL1(GetFlipStatus,p,a) +#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) ICOM_CALL2(GetOverlayPosition,p,a,b) +#define IDirectDrawSurface3_GetPalette(p,a) ICOM_CALL1(GetPalette,p,a) +#define IDirectDrawSurface3_GetPixelFormat(p,a) ICOM_CALL1(GetPixelFormat,p,a) +#define IDirectDrawSurface3_GetSurfaceDesc(p,a) ICOM_CALL1(GetSurfaceDesc,p,a) +#define IDirectDrawSurface3_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawSurface3_IsLost(p) ICOM_CALL (IsLost,p) +#define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) +#define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) +#define IDirectDrawSurface3_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) +#define IDirectDrawSurface3_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface3_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) +#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) +#define IDirectDrawSurface3_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) +#define IDirectDrawSurface3_Unlock(p,a) ICOM_CALL1(Unlock,p,a) +#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) +#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) +#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) +/*** IDirectDrawSurface2 methods ***/ +#define IDirectDrawSurface3_GetDDInterface(p,a) ICOM_CALL1(GetDDInterface,p,a) +#define IDirectDrawSurface3_PageLock(p,a) ICOM_CALL1(PageLock,p,a) +#define IDirectDrawSurface3_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) +/*** IDirectDrawSurface3 methods ***/ +#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) ICOM_CALL2(SetSurfaceDesc,p,a,b) +#endif + + +/***************************************************************************** + * IDirectDrawSurface4 interface + */ +/* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters + * have been converted to LPDIRECTDRAWSURFACE3. + */ +/* FIXME: I assumed IDirectDrawSurface4 does not inherit from IDirectDrawSurface3 but I + * have actually not proof of that. Can someone check and remove this comment or patch + * accordingly ? + */ +#define ICOM_INTERFACE IDirectDrawSurface4 +#define IDirectDrawSurface4_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE4,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE4,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ + ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE4,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE4,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE4,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE4*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ + ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ + ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ + ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ + ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ + ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ + ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ + ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ + ICOM_METHOD (HRESULT,Restore) \ + ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ + ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ + ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ + ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ + ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE4,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE4,lpDDSReference) \ + /* added in v2 */ \ + ICOM_METHOD1(HRESULT,GetDDInterface, LPVOID*,lplpDD) \ + ICOM_METHOD1(HRESULT,PageLock, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,PageUnlock, DWORD,dwFlags) \ + /* added in v3 */ \ + ICOM_METHOD2(HRESULT,SetSurfaceDesc, LPDDSURFACEDESC,lpDDSD, DWORD,dwFlags) \ + /* added in v4 */ \ + ICOM_METHOD4(HRESULT,SetPrivateData, REFGUID,, LPVOID,, DWORD,, DWORD,) \ + ICOM_METHOD3(HRESULT,GetPrivateData, REFGUID,, LPVOID,, LPDWORD,) \ + ICOM_METHOD1(HRESULT,FreePrivateData, REFGUID,) \ + ICOM_METHOD1(HRESULT,GetUniquenessValue, LPDWORD,) \ + ICOM_METHOD (HRESULT,ChangeUniquenessValue) +#define IDirectDrawSurface4_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface4_METHODS +ICOM_DEFINE(IDirectDrawSurface4,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawSurface4_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawSurface4_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawSurface4_Release(p) ICOM_CALL (Release,p) +/*** IDirectDrawSurface (almost) methods ***/ +#define IDirectDrawSurface4_AddAttachedSurface(p,a) ICOM_CALL1(AddAttachedSurface,p,a) +#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) ICOM_CALL1(AddOverlayDirtyRect,p,a) +#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) ICOM_CALL5(Blt,p,a,b,c,d,e) +#define IDirectDrawSurface4_BltBatch(p,a,b,c) ICOM_CALL3(BltBatch,p,a,b,c) +#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) ICOM_CALL5(BltFast,p,a,b,c,d,e) +#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) ICOM_CALL2(DeleteAttachedSurface,p,a,b) +#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) ICOM_CALL2(EnumAttachedSurfaces,p,a,b) +#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) ICOM_CALL3(EnumOverlayZOrders,p,a,b,c) +#define IDirectDrawSurface4_Flip(p,a,b) ICOM_CALL2(Flip,p,a,b) +#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) ICOM_CALL2(GetAttachedSurface,p,a,b) +#define IDirectDrawSurface4_GetBltStatus(p,a) ICOM_CALL1(GetBltStatus,p,a) +#define IDirectDrawSurface4_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawSurface4_GetClipper(p,a) ICOM_CALL1(GetClipper,p,a) +#define IDirectDrawSurface4_GetColorKey(p,a,b) ICOM_CALL2(GetColorKey,p,a,b) +#define IDirectDrawSurface4_GetDC(p,a) ICOM_CALL1(GetDC,p,a) +#define IDirectDrawSurface4_GetFlipStatus(p,a) ICOM_CALL1(GetFlipStatus,p,a) +#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) ICOM_CALL2(GetOverlayPosition,p,a,b) +#define IDirectDrawSurface4_GetPalette(p,a) ICOM_CALL1(GetPalette,p,a) +#define IDirectDrawSurface4_GetPixelFormat(p,a) ICOM_CALL1(GetPixelFormat,p,a) +#define IDirectDrawSurface4_GetSurfaceDesc(p,a) ICOM_CALL1(GetSurfaceDesc,p,a) +#define IDirectDrawSurface4_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawSurface4_IsLost(p) ICOM_CALL (IsLost,p) +#define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) +#define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) +#define IDirectDrawSurface4_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) +#define IDirectDrawSurface4_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface4_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) +#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) +#define IDirectDrawSurface4_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) +#define IDirectDrawSurface4_Unlock(p,a) ICOM_CALL1(Unlock,p,a) +#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) +#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) +#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) +/*** IDirectDrawSurface2 methods ***/ +#define IDirectDrawSurface4_GetDDInterface(p,a) ICOM_CALL1(GetDDInterface,p,a) +#define IDirectDrawSurface4_PageLock(p,a) ICOM_CALL1(PageLock,p,a) +#define IDirectDrawSurface4_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) +/*** IDirectDrawSurface3 methods ***/ +#define IDirectDrawSurface4_SetSurfaceDesc(p,a) ICOM_CALL(SetSurfaceDesc,p,a) +/*** IDirectDrawSurface4 methods ***/ +#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) ICOM_CALL4(SetPrivateData,p,a,b,c,d) +#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) ICOM_CALL3(GetPrivateData,p,a,b,c) +#define IDirectDrawSurface4_FreePrivateData(p,a) ICOM_CALL1(FreePrivateData,p,a) +#define IDirectDrawSurface4_GetUniquenessValue(p,a) ICOM_CALL1(GetUniquenessValue,p,a) +#define IDirectDrawSurface4_ChangeUniquenessValue(p) ICOM_CALL (ChangeUniquenessValue,p) +#endif + + +/***************************************************************************** + * IDirectDrawColorControl interface + */ +#define ICOM_INTERFACE IDirectDrawColorControl +#define IDirectDrawColorControl_METHODS \ + ICOM_METHOD1(HRESULT,GetColorControls, LPDDCOLORCONTROL,lpColorControl) \ + ICOM_METHOD1(HRESULT,SetColorControls, LPDDCOLORCONTROL,lpColorControl) +#define IDirectDrawColorControl_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawColorControl_METHODS +ICOM_DEFINE(IDirectDrawColorControl,IUnknown) +#undef ICOM_INTERFACE + +#ifdef ICOM_CINTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawColorControl_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawColorControl_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawColorControl_Release(p) ICOM_CALL (Release,p) + /*** IDirectDrawColorControl methods ***/ +#define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL(GetColorControls,p,a) +#define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL(SetColorControls,p,a) +#endif + + +HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN); +HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID); +HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID); +#define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) +HRESULT WINAPI DirectDrawCreateClipper(DWORD,LPDIRECTDRAWCLIPPER*,LPUNKNOWN); + +#endif /* __WINE_DDRAW_H */ diff --git a/xc/programs/Xserver/hw/xwin/directx.c b/xc/programs/Xserver/hw/xwin/directx.c new file mode 100644 index 000000000..586b64bd0 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/directx.c @@ -0,0 +1,174 @@ +/* + * (c) Copyright 2000 by Peter Busch + * <pbusch@dfki.de> + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Peter Busch shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Peter Busch. + * +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/directx.c,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ + + +#include <windows.h> +#include <stdio.h> +#include "xf_dx_xwin.h" + +/* external references to funcs in InitInput.c and InitOutput.c */ +extern SwitchFramebuffer( void * ptr ); +extern GenerateInputEvent( type, ix, iy, button ); + +typedef BOOL (__cdecl *_DIInitKeyboard)(); +typedef BOOL (__cdecl *_DIInitMouse)(); +typedef void (__cdecl *_DITermKeyboard)(); +typedef void (__cdecl *_DITermMouse)(); +typedef BOOL (__cdecl *_DXStoreColors)(int i, int r, int g, int b); +typedef void (__cdecl *_ListModes)(void); +typedef void (__cdecl *_set_fn)( __SwitchFramebuffer switch_fb, __GenerateInputEvent gen_inp ); +typedef char*( __cdecl *_winDXAllocateFramebufferMemory) + ( + int* width, + int* height, + int* depth, + int* pitch + ); +typedef void (__cdecl *_winfbBlockHandler)(); +typedef int (__cdecl *_winfbWakeupHandler)(); + + +_DIInitKeyboard xf_DIInitKeyboard = NULL; +_DIInitMouse xf_DIInitMouse = NULL; +_DITermKeyboard xf_DITermKeyboard = NULL; +_DITermMouse xf_DITermMouse = NULL; +_DXStoreColors xf_DXStoreColors = NULL; +_ListModes xf_ListModes = NULL; +_set_fn xf_set_fn = NULL; +_winDXAllocateFramebufferMemory xf_winDXAllocateFramebufferMemory = NULL; +_winfbBlockHandler xf_winfbBlockHandler = NULL; +_winfbWakeupHandler xf_winfbWakeupHandler = NULL; +HINSTANCE h_xf_dx = NULL; + +static BOOL initialized = FALSE; + + +void enable_xf_dx( ) +{ + h_xf_dx = LoadLibrary( "xf_dx.dll" ); + if( h_xf_dx == NULL ) + { + fprintf( stderr, "cannot load xf_dx.dll\n" ); + exit( 1 ); + } + + xf_DIInitKeyboard = + (_DIInitKeyboard)GetProcAddress( h_xf_dx, "DIInitKeyboard" ); + xf_DIInitMouse = + (_DIInitMouse)GetProcAddress( h_xf_dx, "DIInitMouse" ); + xf_DITermKeyboard = + (_DITermKeyboard)GetProcAddress( h_xf_dx, "DITermKeyboard" ); + xf_DITermMouse = + (_DITermMouse)GetProcAddress( h_xf_dx, "DITermMouse" ); + xf_DXStoreColors = + (_DXStoreColors)GetProcAddress( h_xf_dx, "DXStoreColors" ); + xf_ListModes = + (_ListModes)GetProcAddress( h_xf_dx, "ListModes" ); + xf_set_fn = + (_set_fn)GetProcAddress( h_xf_dx, "set_fn" ); + xf_winDXAllocateFramebufferMemory = + (_winDXAllocateFramebufferMemory)GetProcAddress( h_xf_dx, "winDXAllocateFramebufferMemory" ); + xf_winfbBlockHandler = + (_winfbBlockHandler)GetProcAddress( h_xf_dx, "winfbBlockHandler" ); + xf_winfbWakeupHandler = + (_winfbWakeupHandler)GetProcAddress( h_xf_dx, "winfbWakeupHandler" ); + + xf_set_fn( + (__SwitchFramebuffer)SwitchFramebuffer, + (__GenerateInputEvent)GenerateInputEvent + ); + initialized = TRUE; +} + + +/* DX stubs */ + + +BOOL DIInitKeyboard() +{ + return xf_DIInitKeyboard(); +} + +BOOL DIInitMouse() +{ + return xf_DIInitMouse(); + +} + +void DITermKeyboard() +{ + xf_DITermKeyboard(); +} + +void DITermMouse() +{ + xf_DITermMouse(); + +} + +BOOL DXStoreColors(int i, int r, int g, int b) +{ + return xf_DXStoreColors( i, r, g, b ); + +} + +void ListModes(void) +{ + enable_xf_dx(); + xf_ListModes(); +} + +void set_fn( __SwitchFramebuffer switch_fb, __GenerateInputEvent gen_inp ) +{ + return xf_set_fn( switch_fb, gen_inp ); +} + +char* winDXAllocateFramebufferMemory + ( + int* width, + int* height, + int* depth, + int* pitch + ) +{ + enable_xf_dx(); + return xf_winDXAllocateFramebufferMemory( width, height, depth, pitch ); +} + +void winfbBlockHandler() +{ + xf_winfbBlockHandler(); +} + +int winfbWakeupHandler() +{ + return xf_winfbWakeupHandler(); +} + diff --git a/xc/programs/Xserver/hw/xwin/ntux_ddx.h b/xc/programs/Xserver/hw/xwin/ntux_ddx.h new file mode 100644 index 000000000..8c312eb62 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/ntux_ddx.h @@ -0,0 +1,150 @@ +/* +* Copyright 2000 (C) Peter Busch +* All rights reserved. +NO WARRANTY; NO LIABILITY FOR DAMAGES: THE MATERIALS ARE PROVIDED "AS IS" +WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES +OF SATISFACTORY QUALITY, MERCHANTABILITY, NONINFRINGEMENT OF THIRD-PARTY +INTELLECTUAL PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. +IN NO EVENT SHALL Peter Busch BE LIABLE FOR ANY DAMAGES WHATSOEVER +(INCLUDING, WITHOUT LIMITATION, DIRECT OR INDIRECT DAMAGES, DAMAGES FOR +LOSS OF PROFITS, BUSINESS INTERRUPTION, LOSS OF INFORMATION) ARISING OUT +OF THE USE OF OR INABILITY TO USE THE MATERIALS, EVEN IF +Peter Busch HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +Without limiting the generality of the foregoing, no warranty is made +that the enclosed software will generate computer programs with the +characteristics or specifications desired by you or that the demo +software will be error-free. +THESE DISCLAIMERS OF WARRANTY CONSTITUTE AN ESSENTIAL PART OF THIS +AGREEMENT. +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/ntux_ddx.h,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ + +/* +* ntux_ddx.h +* public header file for the ntux_ddx frame buffer library +* Copyright 2000 (C) Peter Busch +* All rights reserved. +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* This code is BETA and will be part of the CYGWIN/XFREE Project. +* It may not be used for purposes other than to contribute to the +* CYGWIN/XFree project without prior written notice from the +* author. +* Any commercial use of this code will be permitted +* provided you contact Peter Busch at pbusch@dfki.de +*/ + + +/* +* for use with the gcc compiler the exported get_surface routine +* is exported with the __cdecl calling convention +*/ + +#ifdef MSC_VER +char *__cdecl get_surface( unsigned long size ); +#else +char *get_surface( unsigned long size ); +#endif + + +#ifdef MSC_VER +char *__cdecl map_dx_fb( char *adr, unsigned long size ); +#else +char *map_dx_fb( char *adr, unsigned long size ); +#endif +/* +* definitions from xfddx_escape.h +* (didn't want include the X-Server specific headers +* needed to to include xfddx_escape.h) +*/ +#define XFDDX_MAP_VIDEO_MEM (0x1998120E) +#define XFDDX_UNMAP_VIDEO_MEM (0x1998120F) +#define XFDDX_KMAP_VIDEO_MEM (0x1998120B) +#define XFDDX_KUNMAP_VIDEO_MEM (0x1998120C) + + +#define FILE_DEVICE_XFMAP (0x00008383) +#define XFMAP_IOCTL_INDEX (0x830) + + +typedef enum { + NOTMAPPED, + XFMAP_XFMAP, + XFMAP_XFDDX_2, + XFMAP_DX, +} xf_mapped; + +/* define IOCTL codes */ +#define XFMAP_MAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP,XFMAP_IOCTL_INDEX + 0, METHOD_NEITHER, FILE_ANY_ACCESS ) + +#define XFMAP_UNMAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP, XFMAP_IOCTL_INDEX + 1,METHOD_NEITHER, FILE_ANY_ACCESS ) + + +#define XFMAP_PMAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP, XFMAP_IOCTL_INDEX + 3,METHOD_NEITHER, FILE_ANY_ACCESS ) + + +#define XFMAP_V2P ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP,XFMAP_IOCTL_INDEX + 4, METHOD_NEITHER, FILE_ANY_ACCESS ) + + + +#ifndef PAGE_SIZE +#define PAGE_SIZE 4096 +#endif + +#define XFMAP_SYS "xfmap" +#define XFMAP_IMG "xfmap.sys" + + + +#ifndef __BUILD_XFDDX__ + +#ifndef _VIDEO_SHARE_MEMORY +typedef struct _VIDEO_SHARE_MEMORY +{ + HANDLE ProcessHandle; + ULONG ViewOffset; + ULONG ViewSize; + PVOID RequestedVirtualAddress; +} VIDEO_SHARE_MEMORY, *PVIDEO_SHARE_MEMORY; +#endif + +#ifndef _VIDEO_SHARE_MEMORY_INFORMATION +typedef struct _VIDEO_SHARE_MEMORY_INFORMATION +{ + ULONG SharedViewOffset; + ULONG SharedViewSize; + PVOID VirtualAddress; +} VIDEO_SHARE_MEMORY_INFORMATION, *PVIDEO_SHARE_MEMORY_INFORMATION; +#endif + + +#ifndef _VIDEO_MEMORY +typedef struct _VIDEO_MEMORY +{ + PVOID RequestedVirtualAddress; +} VIDEO_MEMORY, *PVIDEO_MEMORY; +#endif + +#ifndef _VIDEO_MEMORY_INFORMATION +typedef struct _VIDEO_MEMORY_INFORMATION +{ + PVOID VideoRamBase; + ULONG VideoRamLength; + PVOID FrameBufferBase; + ULONG FrameBufferLength; +} VIDEO_MEMORY_INFORMATION, *PVIDEO_MEMORY_INFORMATION; +#endif +#endif /* __BUILD_XFDDX__ */ + +/* prototypes */ +HANDLE WINAPI load_driver( + char *driver_name, /* driver name, example "xfmap" */ + char *driver_bin /* driver binary, example "xfmap.sys" */ + ); + +BOOL WINAPI unload_driver( + HANDLE h_driver, /* handle to loaded driver */ + char *driver_name /* driver name, example : "xfmap" */ + ); + +BOOL UnloadDeviceDriver( const char * Name ); diff --git a/xc/programs/Xserver/hw/xwin/ntux_xf.c b/xc/programs/Xserver/hw/xwin/ntux_xf.c new file mode 100644 index 000000000..d9e3e964c --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/ntux_xf.c @@ -0,0 +1,267 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/ntux_xf.c,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ + +#include <windows.h> +#include <winioctl.h> +#include <winsvc.h> +#include <memory.h> +#include "stdio.h" +#include "ntux_ddx.h" + +/* #define TEST_STANDALONE 0 */ +static HANDLE h_xfmap = NULL; + + +char *map_dx_fb( char *adr, unsigned long size ) +{ + char *retval = NULL; + unsigned long cb; + + VIDEO_SHARE_MEMORY vsm = {0}; + vsm.RequestedVirtualAddress = adr; + vsm.ViewSize = size; + + if( h_xfmap == NULL ) + { + h_xfmap = load_driver( XFMAP_SYS, XFMAP_IMG ); + if( h_xfmap == NULL ) + return NULL; + } + + if( DeviceIoControl( h_xfmap, + XFMAP_PMAP, + (LPVOID)&vsm, + sizeof(vsm), + (LPVOID)&vsm, + sizeof(vsm), + &cb, + NULL + ) + ) + { + retval = (char*)vsm.RequestedVirtualAddress; + } + return retval; +} + +#ifndef TEST_STANDALONE +static +#endif +int main( int argc, char **argv ) +{ + char *buf = NULL; + char *buf2 = NULL; + + UnloadDeviceDriver( XFMAP_SYS ); + h_xfmap = load_driver( XFMAP_SYS, XFMAP_IMG ); + + fprintf( stderr, "h_xfmap = %08x\n", h_xfmap ); + + buf = (char*)malloc( 100000 ); + if( buf ) + { + buf2 = map_dx_fb( buf, 100000 ); + free( buf ); + } + + + if( h_xfmap ) + unload_driver( h_xfmap, XFMAP_SYS ); +} + + + + +/* +* driver load/unload routines +*/ +BOOL InstallDriver( SC_HANDLE SchSCManager, LPCSTR DriverName, LPCSTR ServiceExe ) +{ + SC_HANDLE schService; + + + schService = CreateService( SchSCManager, // SCManager database + DriverName, // name of service + DriverName, // name to display + SERVICE_ALL_ACCESS, // desired access + SERVICE_KERNEL_DRIVER, // service type + SERVICE_DEMAND_START, // start type + SERVICE_ERROR_NORMAL, // error control type + ServiceExe, // service's binary + NULL, // no load ordering group + NULL, // no tag identifier + NULL, // no dependencies + NULL, // LocalSystem account + NULL // no password + ); + + if ( schService == NULL ) + return FALSE; + + CloseServiceHandle( schService ); + return TRUE; +} + +BOOL StartDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) +{ + SC_HANDLE schService; + BOOL ret; + + schService = OpenService( SchSCManager, + DriverName, + SERVICE_ALL_ACCESS + ); + if ( schService == NULL ) + return FALSE; + + ret = StartService( schService, 0, NULL ) + || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING; + + CloseServiceHandle( schService ); + + return ret; +} + +BOOL OpenDevice( LPCSTR DriverName, HANDLE * lphDevice ) +{ + char completeDeviceName[64]; + HANDLE hDevice; + + + sprintf( completeDeviceName, TEXT("\\\\.\\%s"), DriverName ); + + hDevice = CreateFile( completeDeviceName, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL + ); + if ( hDevice == ((HANDLE)-1) ) + return FALSE; + + /* If user wants handle, give it to them. Otherwise, just close it. */ + if ( lphDevice ) + *lphDevice = hDevice; + else + CloseHandle( hDevice ); + return TRUE; +} + +BOOL StopDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) +{ + SC_HANDLE schService; + BOOL ret; + SERVICE_STATUS serviceStatus; + + schService = OpenService( SchSCManager, DriverName, SERVICE_ALL_ACCESS ); + if ( schService == NULL ) + return FALSE; + + ret = ControlService( schService, SERVICE_CONTROL_STOP, &serviceStatus ); + + CloseServiceHandle( schService ); + + return ret; +} + +BOOL RemoveDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) +{ + SC_HANDLE schService; + BOOL ret; + + schService = OpenService( SchSCManager, + DriverName, + SERVICE_ALL_ACCESS + ); + + if ( schService == NULL ) + return FALSE; + + ret = DeleteService( schService ); + + CloseServiceHandle( schService ); + + return ret; +} + +BOOL LoadDeviceDriver( const char * Name, const char * Path, HANDLE * lphDevice ) +{ + SC_HANDLE schSCManager; + BOOL okay; + + schSCManager = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS ); + + // Ignore success of installation: it may already be installed. + InstallDriver( schSCManager, Name, Path ); + + // Ignore success of start: it may already be started. + StartDriver( schSCManager, Name ); + + // Do make sure we can open it. + okay = OpenDevice( Name, lphDevice ); + + CloseServiceHandle( schSCManager ); + + return okay; +} + +BOOL UnloadDeviceDriver( const char * Name ) +{ + BOOL bResult = TRUE; + SC_HANDLE schSCManager; + + schSCManager = OpenSCManager( NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + + if( !schSCManager ) + return FALSE; + + bResult &= StopDriver( schSCManager, Name ); + bResult &= RemoveDriver( schSCManager, Name ); + + bResult &= CloseServiceHandle( schSCManager ); + + return bResult; +} + +HANDLE WINAPI LoadDriver( LPCSTR szPath, LPCSTR Name ) +{ + HANDLE sys_handle; + + + + if( !LoadDeviceDriver( Name, szPath, &sys_handle ) ) + return NULL; + else + return sys_handle; +} + +BOOL WINAPI UnloadDriver( HANDLE hDriver, LPCSTR szName ) +{ + if( !CloseHandle( hDriver ) ) + return FALSE; + return UnloadDeviceDriver( szName ); +} + +HANDLE WINAPI load_driver( + char *driver_name, /* driver name, example "xfmap" */ + char *driver_bin /* driver binary, example "xfmap.sys" */ + ) +{ + char Path[ MAX_PATH ]; + GetCurrentDirectory( sizeof Path, Path ); + + sprintf( Path+lstrlen(Path), TEXT("\\%s"), driver_bin ); + return LoadDriver( Path, driver_name ); +} + +BOOL WINAPI unload_driver( + HANDLE h_driver, /* handle to loaded driver */ + char *driver_name /* driver name, example : "xfmap" */ + ) +{ + return UnloadDriver( h_driver, driver_name ); +} diff --git a/xc/programs/Xserver/hw/xwin/winkeymap.h b/xc/programs/Xserver/hw/xwin/winkeymap.h new file mode 100644 index 000000000..c4a6ee779 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winkeymap.h @@ -0,0 +1,163 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeymap.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ +/* + * + * For Scancodes see notes in atKeynames.h !!!! + * + */ +/* $TOG: xf86Keymap.h /main/15 1997/07/19 10:02:01 kaleb $ */ + +static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { + /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, + /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, + /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, + /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, + /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, + /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, + /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, + /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, + /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, + /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, + /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, + /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, + /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, + /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, + /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, + /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, + /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, + /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, + /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, + /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, + /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, + /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, + /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, + /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, + /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, + /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, + /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, + /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, + /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, + /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, + /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, + /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, + /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, + /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, + /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, + /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, + /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, + /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, + /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, + /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, + /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, + /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, + /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, + /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, + /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, + /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, + /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, + /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, + /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, + /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, + /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, + /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, + /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, + /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, + /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, + /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, + /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, + /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, + /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, + /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, + /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, + /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, + /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, + /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, + /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, + /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, + /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, + /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, + /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, + /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, + /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, + /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, + /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, + /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, + /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, + /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, + /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, + /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, + /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, + + /* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, + /* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, + /* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, + /* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, + /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, + /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, + /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, + /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, + /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, + /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol, + /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, + /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* These are for ServerNumLock handling */ + /* 0x80 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, + /* 0x81 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, + /* 0x82 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, + /* 0x83 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, + /* 0x84 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, + /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, + /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, + /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, + /* 0x88 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, + /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, + /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, + /* 0x8b */ XK_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x8c */ XK_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x8d */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, + /* 0x8e */ XK_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x8f */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, + /* 0x90 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x91 */ XK_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x92 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x93 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, + /* 0x94 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x95 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, +}; diff --git a/xc/programs/Xserver/hw/xwin/winkeynames.h b/xc/programs/Xserver/hw/xwin/winkeynames.h new file mode 100644 index 000000000..eb91128c7 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winkeynames.h @@ -0,0 +1,335 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeynames.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * + * 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 Thomas Roell not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Roell makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS ROELL 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. + * + */ +/* $TOG: atKeynames.h /main/12 1997/07/19 10:00:17 kaleb $ */ + +#ifndef _ATKEYNAMES_H +#define _ATKEYNAMES_H + +#define XK_TECHNICAL +#define XK_KATAKANA +#include "keysym.h" + +#define GLYPHS_PER_KEY 4 +#define NUM_KEYCODES 150 +#define NUM_STD_KEYCODES 127 +#define MIN_KEYCODE 8 +#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) +#define MAX_STD_KEYCODE (NUM_STD_KEYCODES + MIN_KEYCODE - 1) + +#define AltMask Mod1Mask +#define NumLockMask Mod2Mask +#define AltLangMask Mod3Mask +#define KanaMask Mod4Mask +#define ScrollLockMask Mod5Mask + +#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7))) +#define ModifierDown(k) ((keyc->state & (k)) == (k)) + +#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ + +/* + * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) + * sets of scancodes. Set3 can only be generated by a MF keyboard. + * Set2 sends a makecode for keypress, and the same code prefixed by a + * F0 for keyrelease. This is a little bit ugly to handle. Thus we use + * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. + * Bit 7 ist set if the key is released. The code E0 switches to a + * different meaning to add the new MF cursorkeys, while not breaking old + * applications. E1 is another special prefix. Since I assume that there + * will be further versions of PC/XT scancode compatible keyboards, we + * may be in trouble one day. + * + * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. + * 2) Use the keyboards native set and translate it to common keysyms. + */ + +/* + * definition of the AT84/MF101/MF102 Keyboard: + * ============================================================ + * Defined Key Cap Glyphs Pressed value + * Key Name Main Also (hex) (dec) + * ---------------- ---------- ------- ------ ------ + */ + +#ifndef PC98 + +#define KEY_Escape /* Escape 0x01 */ 1 +#define KEY_1 /* 1 ! 0x02 */ 2 +#define KEY_2 /* 2 @ 0x03 */ 3 +#define KEY_3 /* 3 # 0x04 */ 4 +#define KEY_4 /* 4 $ 0x05 */ 5 +#define KEY_5 /* 5 % 0x06 */ 6 +#define KEY_6 /* 6 ^ 0x07 */ 7 +#define KEY_7 /* 7 & 0x08 */ 8 +#define KEY_8 /* 8 * 0x09 */ 9 +#define KEY_9 /* 9 ( 0x0a */ 10 +#define KEY_0 /* 0 ) 0x0b */ 11 +#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 +#define KEY_Equal /* = (Equal) + 0x0d */ 13 +#define KEY_BackSpace /* Back Space 0x0e */ 14 +#define KEY_Tab /* Tab 0x0f */ 15 +#define KEY_Q /* Q 0x10 */ 16 +#define KEY_W /* W 0x11 */ 17 +#define KEY_E /* E 0x12 */ 18 +#define KEY_R /* R 0x13 */ 19 +#define KEY_T /* T 0x14 */ 20 +#define KEY_Y /* Y 0x15 */ 21 +#define KEY_U /* U 0x16 */ 22 +#define KEY_I /* I 0x17 */ 23 +#define KEY_O /* O 0x18 */ 24 +#define KEY_P /* P 0x19 */ 25 +#define KEY_LBrace /* [ { 0x1a */ 26 +#define KEY_RBrace /* ] } 0x1b */ 27 +#define KEY_Enter /* Enter 0x1c */ 28 +#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 +#define KEY_A /* A 0x1e */ 30 +#define KEY_S /* S 0x1f */ 31 +#define KEY_D /* D 0x20 */ 32 +#define KEY_F /* F 0x21 */ 33 +#define KEY_G /* G 0x22 */ 34 +#define KEY_H /* H 0x23 */ 35 +#define KEY_J /* J 0x24 */ 36 +#define KEY_K /* K 0x25 */ 37 +#define KEY_L /* L 0x26 */ 38 +#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 +#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 +#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 +#define KEY_ShiftL /* Shift(left) 0x2a */ 42 +#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 +#define KEY_Z /* Z 0x2c */ 44 +#define KEY_X /* X 0x2d */ 45 +#define KEY_C /* C 0x2e */ 46 +#define KEY_V /* V 0x2f */ 47 +#define KEY_B /* B 0x30 */ 48 +#define KEY_N /* N 0x31 */ 49 +#define KEY_M /* M 0x32 */ 50 +#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 +#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 +#define KEY_Slash /* / (Slash) ? 0x35 */ 53 +#define KEY_ShiftR /* Shift(right) 0x36 */ 54 +#define KEY_KP_Multiply /* * 0x37 */ 55 +#define KEY_Alt /* Alt(left) 0x38 */ 56 +#define KEY_Space /* (SpaceBar) 0x39 */ 57 +#define KEY_CapsLock /* CapsLock 0x3a */ 58 +#define KEY_F1 /* F1 0x3b */ 59 +#define KEY_F2 /* F2 0x3c */ 60 +#define KEY_F3 /* F3 0x3d */ 61 +#define KEY_F4 /* F4 0x3e */ 62 +#define KEY_F5 /* F5 0x3f */ 63 +#define KEY_F6 /* F6 0x40 */ 64 +#define KEY_F7 /* F7 0x41 */ 65 +#define KEY_F8 /* F8 0x42 */ 66 +#define KEY_F9 /* F9 0x43 */ 67 +#define KEY_F10 /* F10 0x44 */ 68 +#define KEY_NumLock /* NumLock 0x45 */ 69 +#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 +#define KEY_KP_7 /* 7 Home 0x47 */ 71 +#define KEY_KP_8 /* 8 Up 0x48 */ 72 +#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 +#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 +#define KEY_KP_4 /* 4 Left 0x4b */ 75 +#define KEY_KP_5 /* 5 0x4c */ 76 +#define KEY_KP_6 /* 6 Right 0x4d */ 77 +#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 +#define KEY_KP_1 /* 1 End 0x4f */ 79 +#define KEY_KP_2 /* 2 Down 0x50 */ 80 +#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 +#define KEY_KP_0 /* 0 Insert 0x52 */ 82 +#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 +#define KEY_SysReqest /* SysReqest 0x54 */ 84 + /* NOTUSED 0x55 */ +#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 +#define KEY_F11 /* F11 0x57 */ 87 +#define KEY_F12 /* F12 0x58 */ 88 + +#define KEY_Prefix0 /* special 0x60 */ 96 +#define KEY_Prefix1 /* specail 0x61 */ 97 + +/* + * The 'scancodes' below are generated by the server, because the MF101/102 + * keyboard sends them as sequence of other scancodes + */ +#define KEY_Home /* Home 0x59 */ 89 +#define KEY_Up /* Up 0x5a */ 90 +#define KEY_PgUp /* PgUp 0x5b */ 91 +#define KEY_Left /* Left 0x5c */ 92 +#define KEY_Begin /* Begin 0x5d */ 93 +#define KEY_Right /* Right 0x5e */ 94 +#define KEY_End /* End 0x5f */ 95 +#define KEY_Down /* Down 0x60 */ 96 +#define KEY_PgDown /* PgDown 0x61 */ 97 +#define KEY_Insert /* Insert 0x62 */ 98 +#define KEY_Delete /* Delete 0x63 */ 99 +#define KEY_KP_Enter /* Enter 0x64 */ 100 +#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 +#define KEY_Pause /* Pause 0x66 */ 102 +#define KEY_Print /* Print 0x67 */ 103 +#define KEY_KP_Divide /* Didive 0x68 */ 104 +#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 +#define KEY_Break /* Break 0x6a */ 106 +#define KEY_LMeta /* Left Meta 0x6b */ 107 +#define KEY_RMeta /* Right Meta 0x6c */ 108 +#define KEY_Menu /* Menu 0x6d */ 109 +#define KEY_F13 /* F13 0x6e */ 110 +#define KEY_F14 /* F14 0x6f */ 111 +#define KEY_F15 /* F15 0x70 */ 112 +#define KEY_F16 /* F16 0x71 */ 113 +#define KEY_F17 /* F17 0x72 */ 114 +#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 +#define KEY_SN_KP_7 /* ServerNumLock 7 0x80 */ 128 +#define KEY_SN_KP_8 /* ServerNumLock 8 0x81 */ 129 +#define KEY_SN_KP_9 /* ServerNumLock 9 0x82 */ 130 +#define KEY_SN_KP_4 /* ServerNumLock 4 0x83 */ 131 +#define KEY_SN_KP_5 /* ServerNumLock 5 0x84 */ 132 +#define KEY_SN_KP_6 /* ServerNumLock 6 0x85 */ 133 +#define KEY_SN_KP_1 /* ServerNumLock 1 0x86 */ 134 +#define KEY_SN_KP_2 /* ServerNumLock 2 0x87 */ 135 +#define KEY_SN_KP_3 /* ServerNumLock 4 0x88 */ 136 +#define KEY_SN_KP_0 /* ServerNumLock 0 0x89 */ 137 +#define KEY_SN_KP_Dec /* ServerNumLock Decimal 0x8a */ 138 +#define KEY_SN_KP_Home /* ServerNumLock Home 0x8b */ 139 +#define KEY_SN_KP_Up /* ServerNumLock Up 0x8c */ 140 +#define KEY_SN_KP_Prior /* ServerNumLock Prior 0x8d */ 141 +#define KEY_SN_KP_Left /* ServerNumLock Left 0x8e */ 142 +#define KEY_SN_KP_Begin /* ServerNumLock Begin 0x8f */ 143 +#define KEY_SN_KP_Right /* ServerNumLock Right 0x90 */ 144 +#define KEY_SN_KP_End /* ServerNumLock End 0x91 */ 145 +#define KEY_SN_KP_Down /* ServerNumLock Down 0x92 */ 146 +#define KEY_SN_KP_Next /* ServerNumLock Next 0x93 */ 147 +#define KEY_SN_KP_Ins /* ServerNumLock Ins 0x94 */ 148 +#define KEY_SN_KP_Del /* ServerNumLock Del 0x95 */ 149 + +#else + +#define KEY_Escape /* Escape 0x01 */ 0 +#define KEY_1 /* 1 ! 0x02 */ 1 +#define KEY_2 /* 2 " 0x03 */ 2 +#define KEY_3 /* 3 # 0x04 */ 3 +#define KEY_4 /* 4 $ 0x05 */ 4 +#define KEY_5 /* 5 % 0x06 */ 5 +#define KEY_6 /* 6 & 0x07 */ 6 +#define KEY_7 /* 7 ' 0x08 */ 7 +#define KEY_8 /* 8 ( 0x09 */ 8 +#define KEY_9 /* 9 ) 0x0a */ 9 +#define KEY_0 /* 0 0x0b */ 10 +#define KEY_Minus /* - (Minus) = (Equal) 0x0c */ 11 +#define KEY_Hat /* ^ (Hat) ` 0x0d */ 12 +#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 13 +#define KEY_BackSpace /* Back Space 0x0e */ 14 +#define KEY_Tab /* Tab 0x0f */ 15 +#define KEY_Q /* Q 0x10 */ 16 +#define KEY_W /* W 0x11 */ 17 +#define KEY_E /* E 0x12 */ 18 +#define KEY_R /* R 0x13 */ 19 +#define KEY_T /* T 0x14 */ 20 +#define KEY_Y /* Y 0x15 */ 21 +#define KEY_U /* U 0x16 */ 22 +#define KEY_I /* I 0x17 */ 23 +#define KEY_O /* O 0x18 */ 24 +#define KEY_P /* P 0x19 */ 25 +#define KEY_At /* @ ~ 0x1a */ 26 +#define KEY_LBrace /* [ { 0x1b */ 27 +#define KEY_Enter /* Enter 0x1c */ 28 +#define KEY_A /* A 0x1d */ 29 +#define KEY_S /* S 0x1e */ 30 +#define KEY_D /* D 0x1f */ 31 +#define KEY_F /* F 0x20 */ 32 +#define KEY_G /* G 0x21 */ 33 +#define KEY_H /* H 0x22 */ 34 +#define KEY_J /* J 0x23 */ 35 +#define KEY_K /* K 0x24 */ 36 +#define KEY_L /* L 0x25 */ 37 +#define KEY_SemiColon /* ;(SemiColon) +(Plus) 0x26 */ 38 +#define KEY_Colon /* :(Colon) *(Quote) 0x27 */ 39 +#define KEY_RBrace /* ] } 0x28 */ 40 +#define KEY_Z /* Z 0x29 */ 41 +#define KEY_X /* X 0x2a */ 42 +#define KEY_C /* C 0x2b */ 43 +#define KEY_V /* V 0x2c */ 44 +#define KEY_B /* B 0x2d */ 45 +#define KEY_N /* N 0x2e */ 46 +#define KEY_M /* M 0x2f */ 47 +#define KEY_Comma /* , (Comma) < (Less) 0x30 */ 48 +#define KEY_Period /* . (Period) >(Greater)0x31 */ 49 +#define KEY_Slash /* / (Slash) ? 0x32 */ 50 +#define KEY_Under /* _ 0x33 */ 51 +#define KEY_Space /* (SpaceBar) 0x34 */ 52 +#define KEY_Xfer /* (XFER) 0x35 */ 53 +#define KEY_PgUp /* PgUp 0x36 */ 54 +#define KEY_Pgdown /* (Roll Down) 0x37 */ 55 +#define KEY_Insert /* Insert 0x38 */ 56 +#define KEY_Delete /* Delete 0x39 */ 57 +#define KEY_Up /* Up 0x3a */ 58 +#define KEY_Left /* Left 0x3b */ 59 +#define KEY_Right /* Right 0x3c */ 60 +#define KEY_Down /* Down 0x3d */ 61 +#define KEY_Home /* Home 0x3e */ 62 +#define KEY_Help /* Help 0x3f */ 63 +#define KEY_KP_Subtract /* - (Minus) 0x40 */ 64 +#define KEY_KP_Minus /* - */ 64 +#define KEY_KP_Divide /* / (Slash) 0x41 */ 65 +#define KEY_KP_7 /* 7 0x42 */ 66 +#define KEY_KP_8 /* 8 0x43 */ 67 +#define KEY_KP_9 /* 9 0x44 */ 68 +#define KEY_KP_Multiply /* * 0x45 */ 69 +#define KEY_KP_4 /* 4 0x46 */ 70 +#define KEY_KP_5 /* 5 0x47 */ 71 +#define KEY_KP_6 /* 6 0x48 */ 72 +#define KEY_KP_Add /* + (Plus) 0x49 */ 73 +#define KEY_KP_Plus /* + */ 73 +#define KEY_KP_1 /* 1 0x4a */ 74 +#define KEY_KP_2 /* 2 0x4b */ 75 +#define KEY_KP_3 /* 3 0x4c */ 76 +#define KEY_KP_Equal /* = 0x4d */ 77 +#define KEY_KP_0 /* 0 0x4e */ 78 +#define KEY_KP_Separator /* , 0x4f */ 79 +#define KEY_KP_Decimal /* . (Decimal) 0x50 */ 80 +#define KEY_Nfer /* (NFER) 0x51 */ 81 +#define KEY_F11 /* F11 0x52 */ 82 +#define KEY_F12 /* F12 0x53 */ 83 +#define KEY_F13 /* F13 0x54 */ 84 +#define KEY_F14 /* F14 0x55 */ 85 +#define KEY_F15 /* F15 0x56 */ 86 +#define KEY_Break /* (Stop) 0x60 */ 96 +#define KEY_Copy /* (Copy) 0x61 */ 97 +#define KEY_Begin /* Begin ?? */ 97 +#define KEY_F1 /* F1 0x62 */ 98 +#define KEY_F2 /* F2 0x63 */ 99 +#define KEY_F3 /* F3 0x64 */ 100 +#define KEY_F4 /* F4 0x65 */ 101 +#define KEY_F5 /* F5 0x66 */ 102 +#define KEY_F6 /* F6 0x67 */ 103 +#define KEY_F7 /* F7 0x68 */ 104 +#define KEY_F8 /* F8 0x69 */ 105 +#define KEY_F9 /* F9 0x6a */ 106 +#define KEY_F10 /* F10 0x6b */ 107 +#define KEY_ShiftL /* Shift(left) 0x70 */ 112 +#define KEY_CapsLock /* CapsLock 0x71 */ 113 +#define KEY_KanaLock /* Kana 0x72 */ 114 +#define KEY_Alt /* Alt(left) 0x73 */ 115 +#define KEY_LCtrl /* Ctrl(left) 0x74 */ 116 + +#endif /* PC98 */ + +#endif /* _ATKEYNAMES_H */ diff --git a/xc/programs/Xserver/hw/xwin/xf_dx.h b/xc/programs/Xserver/hw/xwin/xf_dx.h new file mode 100644 index 000000000..a1c439ba3 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/xf_dx.h @@ -0,0 +1,106 @@ +/* + * (c) Copyright 2000 by Peter Busch + * <pbusch@dfki.de> + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Peter Busch shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Peter Busch. + * +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/xf_dx.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ + +#ifndef __XF_DX_H__ +#define __XF_DX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef BOOL (__cdecl *_DIInitKeyboard)(); + +typedef BOOL (__cdecl *_DIInitMouse)(); + +typedef void (__cdecl *_DITermKeyboard)(); + +typedef void (__cdecl *_DITermMouse)(); + +typedef BOOL (__cdecl *_DXStoreColors)( int i, int r, int g, int b ); + +typedef void (__cdecl *_ListModes)(); + +typedef char*( __cdecl *_AllocateFramebuffer) + ( + int* width, + int* height, + int* depth, + int* pitch + ); + +typedef void (__cdecl *_winfbBlockHandler)(); + +typedef int (__cdecl *_winfbWakeupHandler)(); + +typedef void (__cdecl *_SwitchFramebuffer)( void * ptr ); + +typedef void (__cdecl *_GenerateInputEvent)( + unsigned long type, + int ix, + int iy, + int button + ); + +typedef void (__cdecl *_set_fn)( + _SwitchFramebuffer switch_fb, + _GenerateInputEvent gen_inp + ); + + +/* +* interface of the xf_dx_library +*/ + +typedef struct _xf_dx_rec +{ + _DIInitKeyboard xf_dx_init_keybd; + _DIInitMouse xf_dx_init_mouse; + _DITermKeyboard xf_dx_term_keybd; + _DITermMouse xf_dx_term_mouse; + _DXStoreColors xf_dx_store_colors; + _ListModes xf_dx_list_modes; + _AllocateFramebuffer xf_dx_alloc_fb; + _winfbBlockHandler xf_dx_block_proc; + _winfbWakeupHandler xf_dx_wakeup_proc; + _SwitchFramebuffer xf_dx_switch_buffer; + _GenerateInputEvent xf_dx_gen_input; + _set_fn xf_dx_set_fn; +} xf_dx_rec, *xf_dx_ptr; + +int __cdecl xf_dx_init( xf_dx_ptr *dx_ptr ); + + +#ifdef __cplusplus +} /* extern "C" { */ +#endif + + +#endif /* __XF_DX_H__ */ diff --git a/xc/programs/Xserver/hw/xwin/xf_dx_xwin.h b/xc/programs/Xserver/hw/xwin/xf_dx_xwin.h new file mode 100644 index 000000000..d0e902a8c --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/xf_dx_xwin.h @@ -0,0 +1,40 @@ +/* + * (c) Copyright 2000 by Peter Busch + * <pbusch@dfki.de> + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Peter Busch shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Peter Busch. + * +*/ +/* $XFree86: xc/programs/Xserver/hw/xwin/xf_dx_xwin.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ + +#ifndef __XF_DX_CALLBACK_H__ +#define __XF_DX_CALLBACK_H__ + + +typedef void (__cdecl *__SwitchFramebuffer)( void * ptr ); +typedef void (__cdecl *__GenerateInputEvent)( type, ix, iy, button ); + + + +#endif diff --git a/xc/programs/Xserver/include/Imakefile b/xc/programs/Xserver/include/Imakefile index d413e25c7..f1f1f723b 100644 --- a/xc/programs/Xserver/include/Imakefile +++ b/xc/programs/Xserver/include/Imakefile @@ -1,18 +1,21 @@ XCOMM $XConsortium: Imakefile,v 1.2 95/01/13 20:28:14 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.16 1999/12/14 01:34:00 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.18 2000/08/10 17:40:39 dawes Exp $ #ifdef XFree86Version #if DoLoadableServer -LinkSourceFile(xf86_libc.h,$(XF86OSSRC)) -LinkSourceFile(xf86_ansic.h,$(XF86OSSRC)) LinkSourceFile(xf86Module.h,$(XF86COMSRC)) LinkSourceFile(xf86Opt.h,$(XF86COMSRC)) #endif +LinkSourceFile(xf86_libc.h,$(XF86OSSRC)) +LinkSourceFile(xf86_ansic.h,$(XF86OSSRC)) LinkSourceFile(xf86Version.h,$(XF86SRC)) LinkSourceFile(compiler.h,$(XF86COMSRC)) #endif LinkSourceFile(osdep.h,../os) +#ifdef cygwinArchitecture +LinkFile(window.h,xxwindow.h) +#endif all:: diff --git a/xc/programs/Xserver/include/misc.h b/xc/programs/Xserver/include/misc.h index 5bfb2bd09..7a09e7052 100644 --- a/xc/programs/Xserver/include/misc.h +++ b/xc/programs/Xserver/include/misc.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.22 1999/08/21 13:48:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.23 2000/08/10 17:40:39 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -140,6 +140,9 @@ typedef struct _xReq *xReqPtr; /* byte swap a short literal */ #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) +#undef min +#undef max + #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) #ifndef IN_MODULE @@ -178,6 +181,12 @@ typedef struct _xReq *xReqPtr; * Some implementations #define these through <math.h>, so preclude * #include'ing it later. */ + +#ifdef __CYGWIN__ +/* needed to avoid INFINITY redeclarations from CYGWIN math.h */ +#define __STRICT_ANSI__ +#endif + #include <math.h> #endif #undef MAXSHORT diff --git a/xc/programs/Xserver/include/os.h b/xc/programs/Xserver/include/os.h index f5829e96d..6243ad504 100644 --- a/xc/programs/Xserver/include/os.h +++ b/xc/programs/Xserver/include/os.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.34 2000/06/16 01:50:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.35 2000/08/02 15:30:36 keithp Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -544,6 +544,18 @@ extern int OsInitColors( #endif ); +void OsBlockSignals ( +#if NeedFunctionPrototypes + void +#endif + ); + +void OsReleaseSignals ( +#if NeedFunctionPrototypes + void +#endif + ); + #if !defined(WIN32) && !defined(__EMX__) extern int System(char *); extern pointer Popen(char *, char *); diff --git a/xc/programs/Xserver/include/resource.h b/xc/programs/Xserver/include/resource.h index 741883a81..9de47b0d9 100644 --- a/xc/programs/Xserver/include/resource.h +++ b/xc/programs/Xserver/include/resource.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.4 2000/01/02 00:24:53 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.5 2000/08/10 17:40:39 dawes Exp $ */ /* $TOG: resource.h /main/24 1998/02/09 14:29:47 kaleb $ */ /*********************************************************** @@ -72,6 +72,8 @@ typedef unsigned long RESTYPE; #define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE) #define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE) #define RT_GC ((RESTYPE)3|RC_CACHED) +#undef RT_FONT +#undef RT_CURSOR #define RT_FONT ((RESTYPE)4) #define RT_CURSOR ((RESTYPE)5) #define RT_COLORMAP ((RESTYPE)6) diff --git a/xc/programs/Xserver/include/windowstr.h b/xc/programs/Xserver/include/windowstr.h index 02350d260..945725069 100644 --- a/xc/programs/Xserver/include/windowstr.h +++ b/xc/programs/Xserver/include/windowstr.h @@ -41,11 +41,16 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.3 2000/08/11 23:59:48 dawes Exp $ */ #ifndef WINDOWSTRUCT_H #define WINDOWSTRUCT_H +#ifndef __CYGWIN__ #include "window.h" +#else +#include "xxwindow.h" +#endif #include "pixmapstr.h" #include "regionstr.h" #include "cursor.h" diff --git a/xc/programs/Xserver/mi/miinitext.c b/xc/programs/Xserver/mi/miinitext.c index f877a73bd..9282a18cf 100644 --- a/xc/programs/Xserver/mi/miinitext.c +++ b/xc/programs/Xserver/mi/miinitext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.50 2000/04/17 16:30:14 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.51 2000/08/09 02:57:20 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -209,9 +209,6 @@ extern void XcupExtensionInit(INITARGS); #ifdef DPMSExtension extern void DPMSExtensionInit(INITARGS); #endif -#ifdef XANTI -extern void XAntiExtensionInit(INITARGS); -#endif #ifdef DPS extern void DPSExtensionInit(INITARGS); #endif @@ -316,9 +313,6 @@ InitExtensions(argc, argv) #ifdef FONTCACHE FontCacheExtensionInit(); #endif -#ifdef XANTI - XAntiExtensionInit(); -#endif #ifdef XF86BIGFONT XFree86BigfontExtensionInit(); #endif @@ -409,7 +403,6 @@ ExtensionModule extension[] = #else { NULL, "NOXINERAMA", NULL, NULL }, #endif - { NULL, "XAnti", NULL, NULL }, { NULL, "XFree86-Bigfont", NULL, NULL }, { NULL, "XFree86-DRI", NULL, NULL }, { NULL, "Adobe-DPS-Extension", NULL, NULL }, diff --git a/xc/programs/Xserver/os/WaitFor.c b/xc/programs/Xserver/os/WaitFor.c index 49361d50b..c6dbae9c0 100644 --- a/xc/programs/Xserver/os/WaitFor.c +++ b/xc/programs/Xserver/os/WaitFor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.24 2000/05/05 17:53:50 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.25 2000/08/10 17:40:39 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -144,6 +144,9 @@ WaitForSomething(pClientsReady) { int i; struct timeval waittime, *wt; +#ifdef __CYGWIN__ + struct timeval waittime0, *wt0; +#endif INT32 timeout; #ifdef DPMSExtension INT32 standbyTimeout, suspendTimeout, offTimeout; @@ -238,7 +241,12 @@ WaitForSomething(pClientsReady) (now - lastDeviceEventTime.milliseconds)); #endif /* DPMSExtension */ - if (timeout <= 0 + if ( +#ifndef __CYGWIN__ + timeout <= 0 +#else + timeout = 0 +#endif #ifdef DPMSExtension && ScreenSaverTime > 0 #endif /* DPMSExtension */ @@ -338,6 +346,10 @@ WaitForSomething(pClientsReady) #ifdef XTESTEXT1 /* XXX how does this interact with new write block handling? */ if (playback_on) { +#ifdef __CYGWIN__ + waittime.tv_sec = 0; + waittime.tv_usec = 0; +#endif wt = &waittime; XTestComputeWaitTime (&waittime); } @@ -350,8 +362,17 @@ WaitForSomething(pClientsReady) XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable); i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt); } - else + else + { +#ifndef __CYGWIN__ i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); +#else + waittime0.tv_sec = 0; + waittime0.tv_usec = 10000; + wt0 = &waittime0; + i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt0); +#endif + } selecterr = errno; WakeupHandler(i, (pointer)&LastSelectMask); #ifdef XTESTEXT1 diff --git a/xc/programs/Xserver/os/auth.c b/xc/programs/Xserver/os/auth.c index 0d40e088e..888f34950 100644 --- a/xc/programs/Xserver/os/auth.c +++ b/xc/programs/Xserver/os/auth.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.4 1998/12/06 06:08:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.5 2000/08/04 16:13:44 eich Exp $ */ /* * authorization hooks for the server @@ -150,6 +150,7 @@ LoadAuthorization (void) #endif if (!f) return 0; + while ((auth = XauReadAuth (f)) != 0) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == auth->name_length && @@ -163,6 +164,7 @@ LoadAuthorization (void) } XauDisposeAuth (auth); } + #if !defined(WIN32) && !defined(__EMX__) Pclose (f); #else diff --git a/xc/programs/Xserver/os/connection.c b/xc/programs/Xserver/os/connection.c index e74412498..da2095284 100644 --- a/xc/programs/Xserver/os/connection.c +++ b/xc/programs/Xserver/os/connection.c @@ -41,7 +41,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.40 2000/06/26 23:00:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.42 2000/08/11 16:52:12 dawes Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -74,12 +74,12 @@ extern int errno; #include <stdio.h> #ifndef WIN32 -#ifndef MINIX -#ifndef Lynx -#include <sys/socket.h> -#else +#if defined(__CYGWIN__) +#include <cygwin/socket.h> +#elif defined(MINIX) || defined(Lynx) #include <socket.h> -#endif +#else +#include <sys/socket.h> #endif #ifdef hpux @@ -117,7 +117,7 @@ extern __const__ int _nfiles; #if defined(TCPCONN) || defined(STREAMSCONN) # include <netinet/in.h> # include <arpa/inet.h> -# ifndef hpux +# if !defined(hpux) && !defined(__CYGWIN__) # ifdef apollo # ifndef NO_TCP_H # include <netinet/tcp.h> @@ -139,7 +139,7 @@ extern __const__ int _nfiles; #include <server/ip/gen/inet.h> #endif -#if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) +#if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) && !defined(__CYGWIN__) #ifndef Lynx #include <sys/uio.h> #else @@ -205,7 +205,7 @@ static fd_set SavedClientsWithInput; int GrabInProgress = 0; int *ConnectionTranslation = NULL; -#ifdef WIN32 +#if defined(WIN32) || defined(__CYGWIN__) /* SPAM ALERT !!! * On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is * not even a known maximum value, so use something quite arbitrary for now. @@ -310,7 +310,7 @@ InitConnectionLimits() ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients); #endif -#ifndef WIN32 +#if !defined(WIN32) && !defined(__CYGWIN__) ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); #else ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(MAXFD)); @@ -335,7 +335,7 @@ CreateWellKnownSockets() FD_ZERO(&LastSelectMask); FD_ZERO(&ClientsWithInput); -#ifndef WIN32 +#if !defined(WIN32) && !defined(__CYGWIN__) for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0; #else for (i=0; i<MAXFD; i++) ConnectionTranslation[i] = 0; @@ -380,7 +380,7 @@ CreateWellKnownSockets() if (!XFD_ANYSET (&WellKnownConnections)) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); -#ifndef WIN32 +#if !defined(WIN32) && !defined(__CYGWIN__) OsSignal (SIGPIPE, SIG_IGN); OsSignal (SIGHUP, AutoResetServer); #endif @@ -403,7 +403,7 @@ CreateWellKnownSockets() * in the second case, the signal will be quite * useful */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(__CYGWIN__) if (OsSignal (SIGUSR1, SIG_IGN) == SIG_IGN) RunFromSmartParent = TRUE; ParentProcess = getppid (); @@ -464,7 +464,7 @@ ResetWellKnownSockets () /* * See above in CreateWellKnownSockets about SIGUSR1 */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(__CYGWIN__) if (RunFromSmartParent) { if (ParentProcess > 0) { kill (ParentProcess, SIGUSR1); diff --git a/xc/programs/Xserver/os/io.c b/xc/programs/Xserver/os/io.c index 77bb79752..0079c9f7d 100644 --- a/xc/programs/Xserver/os/io.c +++ b/xc/programs/Xserver/os/io.c @@ -48,7 +48,7 @@ SOFTWARE. * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.22 2000/05/18 23:46:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.23 2000/08/10 17:40:40 dawes Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -804,7 +804,7 @@ FlushAllOutput() OsCommPtr oc; register ClientPtr client; Bool newoutput = NewOutputPending; -#ifdef WIN32 +#if defined(WIN32) || defined(__CYGWIN__) fd_set newOutputPending; #endif diff --git a/xc/programs/Xserver/os/osinit.c b/xc/programs/Xserver/os/osinit.c index c475e1591..6eb5f9dcc 100644 --- a/xc/programs/Xserver/os/osinit.c +++ b/xc/programs/Xserver/os/osinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.19 1999/12/27 00:39:58 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.20 2000/08/10 17:40:40 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -131,7 +131,7 @@ OsInit() dup2 (fileno (err), 2); fclose (err); } -#if defined(SYSV) || defined(SVR4) || defined(MINIX) || defined(__EMX__) || defined(WIN32) +#if defined(SYSV) || defined(SVR4) || defined(MINIX) || defined(__EMX__) || defined(WIN32) || defined(__CYGWIN__) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); diff --git a/xc/programs/Xserver/os/utils.c b/xc/programs/Xserver/os/utils.c index 337cfb6cd..eed10de61 100644 --- a/xc/programs/Xserver/os/utils.c +++ b/xc/programs/Xserver/os/utils.c @@ -45,9 +45,9 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.59 2000/06/17 00:27:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.63 2000/08/10 17:40:40 dawes Exp $ */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) #include <X11/Xwinsock.h> #endif #include "Xos.h" @@ -181,7 +181,7 @@ OsSignal(sig, handler) return oact.sa_handler; #endif } - + #ifdef SERVER_LOCK /* * Explicit support for a server lock file like the ones used for UUCP. @@ -844,7 +844,7 @@ char *argv[]; #ifdef SERVER_LOCK else if ( strcmp ( argv[i], "-nolock") == 0) { -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__EMX__) && !defined(__CYGWIN__) if (getuid() != 0) ErrorF("Warning: the -nolock option can only be used by root\n"); else @@ -1121,7 +1121,7 @@ ExpandCommandLine(pargc, pargv) { int i; -#if !defined(WIN32) && !defined(__EMX__) +#if !defined(WIN32) && !defined(__EMX__) && !defined(__CYGWIN__) if (getuid() != geteuid()) return; #endif @@ -1644,6 +1644,8 @@ SmartScheduleInit (void) perror ("scheduling timer"); return FALSE; } + /* stop the timer and wait for WaitForSomething to start it */ + SmartScheduleStopTimer (); return TRUE; #else return FALSE; @@ -1651,6 +1653,57 @@ SmartScheduleInit (void) } #endif +#ifdef SIG_BLOCK +static sigset_t PreviousSignalMask; +static int BlockedSignalCount; +#endif + +void +OsBlockSignals (void) +{ +#ifdef SIG_BLOCK + if (BlockedSignalCount++ == 0) + { + sigset_t set; + + sigemptyset (&set); +#ifdef SIGALRM + sigaddset (&set, SIGALRM); +#endif +#ifdef SIGVTALRM + sigaddset (&set, SIGVTALRM); +#endif +#ifdef SIGWINCH + sigaddset (&set, SIGWINCH); +#endif +#ifdef SIGIO + sigaddset (&set, SIGIO); +#endif +#ifdef SIGTSTP + sigaddset (&set, SIGTSTP); +#endif +#ifdef SIGTTIN + sigaddset (&set, SIGTTIN); +#endif +#ifdef SIGTTOU + sigaddset (&set, SIGTTOU); +#endif + sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask); + } +#endif +} + +void +OsReleaseSignals (void) +{ +#ifdef SIG_BLOCK + if (--BlockedSignalCount == 0) + { + sigprocmask (SIG_SETMASK, &PreviousSignalMask, 0); + } +#endif +} + #if !defined(WIN32) && !defined(__EMX__) /* * "safer" versions of system(3), popen(3) and pclose(3) which give up @@ -1759,6 +1812,9 @@ Popen(command, type) _exit(127); } + /* Avoid EINTR during stdio calls */ + OsBlockSignals (); + /* parent */ if (*type == 'r') { iop = fdopen(pdes[0], type); @@ -1810,6 +1866,9 @@ Pclose(iop) last->next = cur->next; xfree(cur); + /* allow EINTR again */ + OsReleaseSignals (); + return pid == -1 ? -1 : pstat; } #endif /* !WIN32 && !__EMX__ */ |